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


Please Help Members By Posting Answers For Below Questions

what are 5 ways to perform a table lookup in sas? : Sas-administrator

772


I have a SCD Type 2 Dimention for Location In which A Sales Office in Having two Surrogate Keys just because of the change in it's Sales Group. SKey SalesGroup Sales Office BeginDate EndDate 280 SG1 SO1 01APR2000 01APR2010 281 SG2 SO1 02APR2010 31MAR2999 Now while loading the Fact, the Lookup ir returning SKey 280 for records before and after 01APR2010. I am not able to give WHERE condition in the Lookup Properties (TranDate between BeginDate and EndDate). Please help.

1700


Which command is used to save logs in the external file?

573


Tell e how how dealt with..

1775


what is the purpose of _error_? : Sas programming

614






What is the role of administrative users? : sas-grid-administration

663


What is program data vector (pdv) and what are its functions?

631


Explain append procedure?

636


What are the implications?

1183


Describe crosslist option in tables statement?

715


Did you used proc test? when?

1577


what is metadata? : Sas-bi

602


If you were told to create many records from one record, show how you would do this using array and with proc transpose?

806


What are the different operating system platforms in which we can use sas? : sas-grid-administration

595


How do you add a number to a macro variable? : sas-macro

546