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 you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?
What’s the difference between var b1 – b3 and var b1 — b3?
What do the sas log messages “numeric values have been converted to character” mean? What are the implications?
How is character variable converted into numeric variable and vice versa?
Mention some common errors that are usually committed in sas programming.
what is PhaseIII, ODS, TLG, Macro and Proc in SAS
what do the sas log messages "numeric values have been converted to character" mean? : Sas programming
what is sas business intelligence? : Sas-bi
how do you want missing values handled? : Sas programming
Mention the validation tools used in SAS?
I have 3 years of work experience at a startup and recently got certified in Data Science with SAS. I need to know how to get into the analytics industry
what is SAS OPTIMIZATION?
what is the difference between nodup and nodupkey options? : Sas programming
Which function is used to count the number of intervals between two sas dates?
What is program data vector (pdv) and what are its functions?