BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nikhil_1393
Calcite | Level 5

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....!

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

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;
PeterClemmensen
Tourmaline | Level 20

Also, it is good practice to have some delimiter between your data values. 

 

Makes it much easier to work with 🙂

Nikhil_1393
Calcite | Level 5

Thanks very much for your help.....!

euro_andres
Fluorite | Level 6

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1239 views
  • 6 likes
  • 3 in conversation