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
proc sql;
select
case when date lt '31DEC2006'd then date end as mydate
format=date7. from d1
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;
Just that these are in three different columns;
Tried the above resolutions but unsuccessfully.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
If a variable contains letters or special characters, can it be numeric data type?
What are the difficulties u faced while doing vital signs table or dataset?
do you need to know if there are any missing values? : Sas programming
If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable? : sas-macro
how to do user inputs and command line arguments in sas?
how are numeric and character missing values represented internally? : Sas programming
Enlist the functions performed by sas.
What are the difference between sas functions and procedures?
explain the key concept of sas? : Sas-administrator
what are sas bi dashboard components? : Sas-bi
what is sas application server? : Sas-di
What do the put and input function do?
what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming
What do you know about sas data set?
Name some categories in sas 9? : sas-grid-administration