Hello, it would be much appreciated, if somone could point out the syntax error.
The contents of the raw data file CALENDAR are listed below:
--------10-------20-------30
01012000
The following SAS program is submitted:
data test;
infile 'calendar';
input @1 date mmddyy10.;
if date = '01012000'd then event = 'January 1st';
run;
Which one of the following is the value of the EVENT variable?
A. The value can not be determined as the program fails to execute due to errors
B. . (missing numeric value)
C. January 1st
D. 01012000
Answer: A.
Date literals are in the form of "10Jan2016"d. The case is optional and quotes may be single or double but the month must be the 3 letter abbreviation and either the last 2 digits of year or the 4 digit version.
Date literals are in the form of "10Jan2016"d. The case is optional and quotes may be single or double but the month must be the 3 letter abbreviation and either the last 2 digits of year or the 4 digit version.
Hey ballardw, are you saying SAS can only read "JAN", "FEB", ... as the month from raw data files? I must have missed that during my studying, but that sounds a bit troublesome. So SAS would not be able to read a raw data file that contains 01012000 or 01/01/2000 or 31/12/200 or JAN122000? That would be interesting to note.
Wait hold on. I think I see the error. By Date literal, you the "01012000"d part. Not the info in the raw data file. Thanks much. That helps!
Link to SAS Analytics U
Yeah, I have SAS Uni. But I can't access it at work... strict downloading restrictions. Anyways, thanks for the help!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.