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


Please Help Members By Posting Answers For Below Questions

Can you explain the process of calendar?

642


What is connection profile? : sas-grid-administration

652


How to sort in descending order?

798


What does the trace option do?

671


What do the SAS log messages "numeric values have been converted to character" mean?

892






What is the sas data set? : sas-grid-administration

576


How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

752


How to limit decimal places for variable using proc means?

592


what r the job openings SAS for fresher graduates !

2021


Did you used proc test? when?

1577


How do you define proc in sas? : sas-grid-administration

678


What is the use of function Proc summary?

657


what is sas business intelligence? : Sas-bi

590


Describe 5 ways to do a “table lookup” in SAS?

703


How to limit decimal places for the variable using proc means?

606