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 does the trace option do?
what is sas metadata repository? : Sas-bi
Can you execute a macro within a macro? Describe. : sas-macro
explain the proc in sas? : Sas-administrator
Differences between where and if statement?
Describe 5 ways to do a “table lookup” in SAS?
what is factor analysis? : Sas-administrator
What is the use of stop statement?
what are the new features included in the new version of sas i.e., Sas 9.1.3? : Sas programming
How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730?
How you can read the variables that you need?
what is the use of sas management console? : Sas-di
what is the purpose of _error_? : Sas programming
What are common programming errors committed in sas
What is the use of %include statement?