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 / sudheendra reddy & veerend
DATA D1;
INPUT SLNO DATE DATE7.;
DATALINES;
1 12DEC73
2 22NOV71
3 01JAN76
4 12FEB77
5 13MAR83
6 24APR90
7 17MAY99
;
RUN;
proc format ;
value dat low-'31DEC1974'd=[date7.]
'01JAN1975'd-'31DEC1984'd="Disco Years"
'01JAN1985'd-high=[date9.];
RUN;
proc print data=D1 noobs label;
format DATE dat.;
RUN;
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
Explain the difference between using drop = data set option in set and data statement?
What are the prime responsibilities of data integration administrator? : Sas-di
Enlist the syntax rules followed in sas statements.
Why and when do you use proc sql?
what are several options for creating reports in web report studio? : Sas-bi
What is a macro routine?
what can you learn from the sas log when debugging? : Sas programming
Can you suggest us materials for sdtm mapping?
what is study design in while working with SAS? what are screening variables in SAS?
how does sas handle missing values in assignment statements? : Sas programming
explain the function of substr in sas? : Sas-administrator
What is the difference between using drop = data set option in data statement and set statement?
i have a dataset with 100 obs i want to generate title from 20th obs onwards with total observations. that should contain 100 obs.dont use firstobs and dnt split the data. use dataset block or proc report? how can we genarate;
What are the functions which are used for character handling functions?
Explain what is SAS informats?