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 it's between 1975 and 1985.
How would you accomplish this in data step code? Using
only PROC FORMAT
Answer Posted / sheldon
proc sql;
create table fmtdate(keep=newdate) as
select date,
case
when date lt '31DEC1974'd then put(date,date7.)
when date gt '31DEC1984'd then put(date,date9.)
else 'Desco Year'
end as newdate
from d1;
quit;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is program data vector (pdv)?
How will you use the WHO Drug Dictionary for Reporting Clinical Trials?
how do you test for missing values? : Sas programming
what is function of retain statment
What is the difference between match merge and one to one merge?
Explain the difference between using drop = data set option in set and data statement?
Which command is used to save logs in the external file?
which date functions advances a date time or date/time value by a given interval? : Sas programming
Tell me about % include and % eval? : sas-macro
What is the difference between input and infile statement?
What do you code to create a macro? : sas-macro
What are the five ways to do a table lookup in sas? : sas-grid-administration
what does the run statement do? : Sas programming
What are the ways in which macro variables can be created in sas programming?
what are validation tools that are used in sas? : Sas-administrator