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
its
between 1975 and 1985. How would you accomplish this in
data step code? Using only PROC FORMAT.
Answer Posted / j. sheetal
Here is the correction in above example,
proc format;
value datestyl low-'31dec1974'd = [date7.]
'01jan1975'd - '31dec1985'd = 'disco Years'
'01jan1986'd - high = [date9.] ;
Run;
Example:
data k1;
input date2 $9.;
cards;
31dec1974
01jan1975
01jan1985
01jan1990
;
data temp;
set k1;
date1=input(date2,date9.);
sam = date1;
format sam datestyl.;
run;
proc print;
run;
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
for whom is sas data integration studio designed? : Sas-di
What are the scrubbing procedures in sas?
Explain how merging helps to combine data sets.
Why double trailing @@ is used in input statement?
what is the use of proc contents and proc print in sas? : Sas-administrator
in the flow of data step processing, what is the first action in a typical data step? : Sas programming
What is proc sort?
Give e an example of..
What are the table names in oracle database...?
what are sas/access and sas/connect? : Sas programming
what is data integration? : Sas-di
what is star schema? : Sas-di
what are all the reports you generated in your recent project?
how to remove duplicates using proc sql?
what is slowly changing dimension? : Sas-di