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
What is a method to debug and test your SAS program?
how are numeric and character missing values represented internally? : Sas programming
Explain the difference between informat and format with an example.
What is the basic structure of the SAS base program?
Differentiate input and infile.
If a variable contains letters or special characters, can it be numeric data type?
Explain input and put function?
How we can create SAS USER DEFINED CODE?
What will calendar procedure do?
Explain the difference between using drop = data set option in set and data statement?
Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com
Do you know the features of sas?
Explain what is the use of proc gplot?
what is study design in while working with SAS? what are screening variables in SAS?
What is the maximum length of the macro variable?