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
how sas deals with business intelligence? : Sas-bi
if you were told to create many records from one record, show how you would do this using array and with proc transpose? : Sas programming
Mention common programming errors committed in sas ?
how does sas handle missing values in sort order? : Sas programming
How would you identify a macro variable?
what is operational data and operational system? : Sas-di
Can you execute macro within another macro? : sas-macro
what does the run statement do? : Sas programming
name several ways to achieve efficiency in your program? : Sas programming
How can you limit the variables written to output dataset in data step?
what are the types of interactive display types? : Sas-bi
what are the best practices to process the large data sets in sas programming? : Sas-administrator
Hi, If anyone has base SAS certification dumps, please share.
What is the use of the %include statement?
what is sas metadata repository? : Sas-bi