There is a field containing a date. It needs to be
displayed in the format “ddmonyy” if it’s before
1975,”dd
mon ccyy” if it’s after 1985, and as ‘disco years’ if
its
between 1975 and 1985. How would you accomplish this in
data step code? Using only PROC FORMAT.
Answer Posted / kamalan
proc format;
value datestyl low-'31dec1974'd = [date7.]
'01jan1975'd - '31dec1985'd = 'disco Years'
'01jan1986'd - max = [date9.] ;
Run;
proc print data = abc;
format dateval datestyl.;
Run;
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
how does sas handle missing values in formats? : Sas programming
What are the data types does SAS contain?
what is the difference between: x=a+b+c+d; and x=sum (of a, b, c ,d);? : Sas programming
Give e an example of..
Explain what is the use of proc gplot?
what is sas and what are the functions? : Sas-administrator
Where do you use proc means over proc freq?
How do you use the do loop if you don’t know how many times you should execute the do loop?
what is sas metadata server? : Sas-di
Mention what is PROC in SAS?
What is the difference between using drop = data set option in data statement and set statement?
how can you put a "trace" in your program? : Sas programming
What is the work of tranwrd function?
How will you react when, while consulting a SAS documentation manual to get an answer to a problem, someone says hey, I thought you were supposed to know all that stuff already, and not have to look it up in a book?
what are the component of range? : Sas-bi