The contents of the raw data file CALENDAR are listed below:
--------10-------20-------30
01012000
01012000
The following SAS program is submitted:
data test;
infile 'calendar';
input @1 date mmddyy10.;
if date = '01012000'd then event = 'January 1st';
run;
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. 01012000
B. January 1st
C. . (missing numeric value)
D. The value can not be determined as the program fails to execute due to errors.
A. 01012000
B. January 1st
C. . (missing numeric value)
D. The value can not be determined as the program fails to execute due to errors.
6 comments:
Answer D
The if date = '01012000'd then event = 'January 1st'; has a syntax error.
The date constant '01012000'd should be ‘01Jan2000’d.
data work.TEST;
infile cards;
input @1 date mmddyy10.;
if date = '01jan2000'd then event = 'January 1st';
cards;
01012000
;
run;
Any more on this one Sasguru? Why do you have to use '01Jan2000'd for the date constant?
That's just the way it was programmed. The date constant can only recognize and convert date values given in the format 'ddmmmyyyy'd . It doesn't recognize the given series of numbers as a date.
My answer is D:
Here there is a syntax error.
The date constant displayed as '01012000'd should be ‘01Jan2000’d.
Not enough,wanna something more related to SAS Macros
Hats off to your presence of mind..I really enjoyed reading your blog. I really appreciate your information which you shared with us.
SAS Online Training
Tableau Online Training|
R Programming Online Training|
This is such a great post, and I was expectign further more updtates from your blog. Another great update.All the best for all of your work.
Java training in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
Post a Comment