DATA BIRTHDATES;
INPUT ID $ 1-5 GENDER $ 6 MARRIED 7 BDATE 8-16 ;
FORMAT BDATE WORDDATE18.;
DATALINES;
00001M112JAN1999
00021F003MAR1989
00043F018JUL1991
00054M022DEC1998
00132F110JUL1992
;
Title "FRIEND'S BIRTHDATES";
PROC PRINT DATA=BIRTHDATES;
RUN;
In this example my output is showing the BDATE column as blank despite specifying the DATE format for the same.Please help me out....!
Use the date9 informat on BDATE to tell SAS how to read it
data birthdates;
input id $ 1-5 gender $ 6 married 7 bdate:date9.;
format bdate worddate18.;
datalines;
00001m112jan1999
00021f003mar1989
00043f018jul1991
00054m022dec1998
00132f110jul1992
;
title "friend's birthdates";
proc print data=birthdates;
run;
Use the date9 informat on BDATE to tell SAS how to read it
data birthdates;
input id $ 1-5 gender $ 6 married 7 bdate:date9.;
format bdate worddate18.;
datalines;
00001m112jan1999
00021f003mar1989
00043f018jul1991
00054m022dec1998
00132f110jul1992
;
title "friend's birthdates";
proc print data=birthdates;
run;
Also, it is good practice to have some delimiter between your data values.
Makes it much easier to work with 🙂
Thanks very much for your help.....!
Hello My friend,
As everyone said you need to use an informat. Keep in mind that formats is the way information is shown in an output while INformat is the way information is read from an external source.
Hope this helps.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.