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 / amit gupta
Apologies,
above code has an extra "FROM d1"
The working code is as below:
proc sql;
select
case when date lt '31DEC2006'd then date end as mydate
format=date7. ,
case when date gt '31DEC2008'd then date end as mydate
format=date9. ,
case when '01JAN2007'd <= date <= '31DEC2008'd then 'DUMMY'
end as mydate
from d1 ;
quit;
However it does give the data in 3 columns , which I was
unable to merge as the data type was different.
Any working solution using format ?
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can you explain the process of calendar?
What is connection profile? : sas-grid-administration
How to sort in descending order?
What does the trace option do?
What do the SAS log messages "numeric values have been converted to character" mean?
What is the sas data set? : sas-grid-administration
How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?
How to limit decimal places for variable using proc means?
what r the job openings SAS for fresher graduates !
Did you used proc test? when?
How do you define proc in sas? : sas-grid-administration
What is the use of function Proc summary?
what is sas business intelligence? : Sas-bi
Describe 5 ways to do a “table lookup” in SAS?
How to limit decimal places for the variable using proc means?