|
I have a delimited data file (delimited with |) that contains id, date,
time, another date, another time, gender, and age.
I tried to read it with the following code:
data TEMP;
length id $10. vdate 8. timetext $10. ddate 8. dtimetext $10.
gender $1. ageyears 8.;
infile 'TEMP.TXT' DSD delimiter='7C'x TRUNCOVER;
input id $ vdate yymmdd10. timetext $ ddate yymmdd10. dtimetext $
gender $ ageyears ;
format vdate ddate mmddyy10.;
run;
However, I am not reading the data correctly and am having the most
trouble reading the time variables.
What am I doing wrong?
Thanks,
Karen Olson
Children's Hospital Boston
karen.olson@tch.harvard.edu
--------------------------------
This is my sample data file:
--------------------------------
2y3034821c|2000/07/05|03:05 AM|2000/03/29|11:52 PM|M|49
72db1acd0f|2000/12/16|11:03 AM|||M|
bb4e2a0718|2000/07/28||||M|48
6d59ff5c05|2000/02/10|11:13 PM|||F|37
ff1361cc92|2000/09/25|01:16 AM|||M|51
4cbc8e3bcc|||||M|51
3a30f0c61c|2000/03/29|04:37 PM||||
f7331c4b6e|2000/12/27|03:16 PM|||F|47
d5f747e0dd|2000/08/09|10:00 AM|||F|47
077739b87d|2000/12/18|04:55 PM|||F|57
4ff29e7e20|2000/12/17|00:12 AM||||68
nf8ss7f4db|2000/03/28|03:37 AM|||F|59
a118a49ba7|2000/06/14|09:02 PM|||F|57
6780 77b80|2000/07/10|07:37 PM|||F|57
nhk034857b|2000/05/08|03:37 PM|||M|26
--------------------------------
This is what my code yields:
--------------------------------
Obs id vdate timetext ddate dtimetext gender ageyears
1 2y3034821c 07/05/2000 . 000/03/29 1 .
2 72db1acd0f 12/16/2000 . M .
3 bb4e2a0718 07/28/2000 . .
4 6d59ff5c05 02/10/2000 . F 37
5 ff1361cc92 09/25/2000 . M 51
6 4cbc8e3bcc . . .
7 3a30f0c61c 03/29/2000 . .
8 f7331c4b6e 12/27/2000 . F 47
9 d5f747e0dd 08/09/2000 . F 47
10 077739b87d 12/18/2000 . F 57
11 4ff29e7e20 12/17/2000 . 68
12 nf8ss7f4db 03/28/2000 . F 59
13 a118a49ba7 06/14/2000 . F 57
14 6780 77b80 07/10/2000 . F 57
15 nhk034857b 05/08/2002 . M 26
|