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
What is interleaving in SAS?
Do you need to rearrange the order of the data for the report?
for what purpose would you use the retain statement? : Sas programming
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?
Explain why double trailing @@ is used in input statement?
What is a macro routine?
Name types of category in which SAS Informats are placed?
Differences between where and if statement?
What do you know about symput and symget?
what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?
describe the interaction table in sas di? : Sas-di
Give some examples where proc report’s defaults are different than proc print’s defaults?
Describe the function and untility of the most difficult SAS macro that you have written.
do you prefer proc report or proc tabulate? Why? : Sas programming
how could you generate test data with no input data? : Sas programming