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 does the trace option do?

666


what is sas metadata repository? : Sas-bi

603


Can you execute a macro within a macro? Describe. : sas-macro

674


explain the proc in sas? : Sas-administrator

624


Differences between where and if statement?

584






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

701


what is factor analysis? : Sas-administrator

615


What is the use of stop statement?

644


what are the new features included in the new version of sas i.e., Sas 9.1.3? : Sas programming

547


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?

1161


How you can read the variables that you need?

653


what is the use of sas management console? : Sas-di

613


what is the purpose of _error_? : Sas programming

612


What are common programming errors committed in sas

674


What is the use of %include statement?

619