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
How to create an external dataset with sas code?
For a user to have access to a standard workspace server, is internal authentication alone is sufficient? : sas-grid-administration
What are the statements that are executed only?
how to do user inputs and command line arguments in sas?
Define run-group processing?
What is the difference between INPUT and INFILE ?
Describe the ways in which you can create macro variables?
how does sas handle missing values in sort order? : Sas programming
List out some key concept of SAS
Explain the difference between using drop = data set option in set and data statement?
what are 5 ways to perform a table lookup in sas? : Sas-administrator
What is the use of function Proc summary?
sas implementing companies in pune implementing clinical projects if anyone knows plz send ans immediately
what are the considerations when picking a SAS/STAT procedure?
What is the use of PROC gplot?