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

What is a method to debug and test your SAS program?

729


how are numeric and character missing values represented internally? : Sas programming

627


Explain the difference between informat and format with an example.

695


What is the basic structure of the SAS base program?

696


Differentiate input and infile.

604






If a variable contains letters or special characters, can it be numeric data type?

768


Explain input and put function?

655


How we can create SAS USER DEFINED CODE?

1621


What will calendar procedure do?

606


Explain the difference between using drop = data set option in set and data statement?

687


Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com

1589


Do you know the features of sas?

600


Explain what is the use of proc gplot?

715


what is study design in while working with SAS? what are screening variables in SAS?

1687


What is the maximum length of the macro variable?

684