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

tianerhu_0-1622026132292.png

data work.family;
infile datalines;
input relation $ first_name $ birthdate mmddyy8.;
datalines;
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
;
proc print data = work.family;
*format birthdate mmddyy10.;
run;

 

The answer tells that the colon must be added. But , I get the perfect output without it , why?

1 ACCEPTED SOLUTION

Accepted Solutions
CarmineVerrell
SAS Employee

The difference you are seeing is because you did not use the exact datalines.  If you look closely you will see that in the second line of the datalines there are spaces in front of the birthdate value.  Try including the extra spaces and you will see that the code will not execute properly without the colon.

View solution in original post

4 REPLIES 4
WarrenKuhfeld
Ammonite | Level 13

The spaces in the raw data are significant. Try again with the spacing exactly as stated in the problem.

tianerhu
Pyrite | Level 9

Thank you for your help.

CarmineVerrell
SAS Employee

The difference you are seeing is because you did not use the exact datalines.  If you look closely you will see that in the second line of the datalines there are spaces in front of the birthdate value.  Try including the extra spaces and you will see that the code will not execute properly without the colon.

tianerhu
Pyrite | Level 9

Thank you very much.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

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
  • 932 views
  • 0 likes
  • 3 in conversation