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
Rhodochrosite | Level 12

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 577 views
  • 0 likes
  • 3 in conversation