I am having trouble reading in one particular column of data. The raw text file column I am having trouble with looks like this:
The form is minute minute : second second ms ms. this particular data does not go into the hours. I tried formatting the variable as TIME6.2; but I am getting missing values for over 70% of the data. I also messed around with adjusting the width. I also tried using the informat mmss but I did not have any success. However I may be using it incorrectly. As of now, I am reading the data in as a character value but I need it to be a numeric value so I can do data comparisons.
Any advice would be greatly appreciated!
EDIT: I wanted to make a note that these are elapsed times(race results). I hope to read the data in and then be able to compare the race times as to rank 1st,2nd,3rd place etc.
Best How To :
First thing you need to understand is the difference between informats and formats.
Informat is a pattern that SAS uses to convert text into a number. The informat you want to use is
The format is something that is applied to a number; it tells SAS how you want a particular number to be displayed or printed. In order to represent your times, you need a width greater than 6 to account for the
. characters you want printed. Try something larger like
time12.2 format. Total width of 12, with two spaces for the ms digits:
EDIT: Assuming your text file is delimited, it seems the
hhmmss informat doesn't like values that are not wide enough. It does work if you read the time in as character
$ then use the
input() function to convert the times to numbers.
format finaltime time12.2;
infile cards dlm=',';
input age team finaltimec $ score;
finaltime = input(finaltimec,?? hhmmss.);