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


Please Help Members By Posting Answers For Below Questions

How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?

1588


What’s the difference between var b1 – b3 and var b1 — b3?

836


What do the sas log messages “numeric values have been converted to character” mean? What are the implications?

732


How is character variable converted into numeric variable and vice versa?

602


Mention some common errors that are usually committed in sas programming.

594






what is PhaseIII, ODS, TLG, Macro and Proc in SAS

3909


what do the sas log messages "numeric values have been converted to character" mean? : Sas programming

544


what is sas business intelligence? : Sas-bi

590


how do you want missing values handled? : Sas programming

536


Mention the validation tools used in SAS?

658


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

1329


what is SAS OPTIMIZATION?

1818


what is the difference between nodup and nodupkey options? : Sas programming

625


Which function is used to count the number of intervals between two sas dates?

575


What is program data vector (pdv) and what are its functions?

631