- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sorry beginner here How to make SAS read the date, when I proc print there's nothing print for dates
DATA bp;
INFILE DATALINES;
input id ;
$4 dob : mmddyy10. $4 admit : mmddyy10. $4 dischrg : mmddyy10. fee ;
DATALINES;
001 10/21/1946 12/12/2004 12/14/2004 8000
002 05/01/1980 07/08/2004 08/08/2004 12000
003 01/01/1960 01/01/2004 01/04/2004 9000
004 06/23/1998 11/11/2004 12/25/2004 15123
run;
PROC PRINT DATA= bp;
RUN;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA bp;
INFILE DATALINES;
input id
$3. dob : mmddyy10. admit : mmddyy10. dischrg : mmddyy10. fee ;
format dob admit dischrg mmddyy10.;;
DATALINES;
001 10/21/1946 12/12/2004 12/14/2004 8000
002 05/01/1980 07/08/2004 08/08/2004 12000
003 01/01/1960 01/01/2004 01/04/2004 9000
004 06/23/1998 11/11/2004 12/25/2004 15123
run;
PROC PRINT DATA= bp;
RUN;
Obs | id | dob | admit | dischrg | fee |
---|---|---|---|---|---|
1 | 001 | 10/21/1946 | 12/12/2004 | 12/14/2004 | 8000 |
2 | 002 | 05/01/1980 | 07/08/2004 | 08/08/2004 | 12000 |
3 | 003 | 01/01/1960 | 01/01/2004 | 01/04/2004 | 9000 |
4 | 004 | 06/23/1998 | 11/11/2004 | 12/25/2004 | 15123 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA bp;
INFILE DATALINES;
input id
$3. dob : mmddyy10. admit : mmddyy10. dischrg : mmddyy10. fee ;
format dob admit dischrg mmddyy10.;;
DATALINES;
001 10/21/1946 12/12/2004 12/14/2004 8000
002 05/01/1980 07/08/2004 08/08/2004 12000
003 01/01/1960 01/01/2004 01/04/2004 9000
004 06/23/1998 11/11/2004 12/25/2004 15123
run;
PROC PRINT DATA= bp;
RUN;
Obs | id | dob | admit | dischrg | fee |
---|---|---|---|---|---|
1 | 001 | 10/21/1946 | 12/12/2004 | 12/14/2004 | 8000 |
2 | 002 | 05/01/1980 | 07/08/2004 | 08/08/2004 | 12000 |
3 | 003 | 01/01/1960 | 01/01/2004 | 01/04/2004 | 9000 |
4 | 004 | 06/23/1998 | 11/11/2004 | 12/25/2004 | 15123 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much!, why do you use $3 instead $4 i don't understand the $ sign, is that mean by columns? 3rd column?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Lvp8906 The instruction that is given using Input statement goes like this:
$3- $ dollar stands for the value to be read a character. 3 bytes of character to be read from the input buffer into the PDV to the build the observation. 001 002 appears only 3 bytes with 1 byte of space for each character.
Yes one column position contains value of 1 byte
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Lvp8906 - $3. defines how SAS reads the ID data. $ means read the data as character, 3 means read the first three columns of data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA bp;
INFILE DATALINES;
input id $3. (dob admit dischrg) (: anydtdte.) fee ;
format dob admit dischrg mmddyy10.;
DATALINES;
001 10/21/1946 12/12/2004 12/14/2004 8000
002 05/01/1980 07/08/2004 08/08/2004 12000
003 01/01/1960 01/01/2004 01/04/2004 9000
004 06/23/1998 11/11/2004 12/25/2004 15123
run;
PROC PRINT DATA= bp;
RUN;