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
its
between 1975 and 1985. How would you accomplish this in
data step code? Using only PROC FORMAT.
Answers were Sorted based on User's Feedback
Answer / kamalan
proc format;
value datestyl low-'31dec1974'd = [date7.]
'01jan1975'd - '31dec1985'd = 'disco Years'
'01jan1986'd - max = [date9.] ;
Run;
proc print data = abc;
format dateval datestyl.;
Run;
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / j. sheetal
Here is the correction in above example,
proc format;
value datestyl low-'31dec1974'd = [date7.]
'01jan1975'd - '31dec1985'd = 'disco Years'
'01jan1986'd - high = [date9.] ;
Run;
Example:
data k1;
input date2 $9.;
cards;
31dec1974
01jan1975
01jan1985
01jan1990
;
data temp;
set k1;
date1=input(date2,date9.);
sam = date1;
format sam datestyl.;
run;
proc print;
run;
| Is This Answer Correct ? | 4 Yes | 0 No |
How do you put a giraffe into the refrigerator?
what is the primary variable in your study?
How do you control the number of observations and/or variables read or written?
wat has been most common programming mistake?
I Here clinical SAS training by Ramesh Azmeera is good. Is it confirm ?
how to import XTP files into SAS datasets?
1 Answers Barclays, Institute For Plasma Research,
How would you define the end of a macro? : sas-macro
What are the analysis datasets created, and what are the new variables created in CLINICAL SAS
1 Answers Accenture, Sciformix,
Are the preferred term counts are always equal to Body system counts? If so, Why are they equal if not why they are not equal?
How to do user inputs and command line arguments in SAS? D&B
How would you delete duplicate observations?
I use NOCUM/NOPERCENT option in the tables statement like this Proc freq data = deepak; tables x y /nocum nopercent; run; Here I get nopercent and nocum in the output only for variables x and y. How do i do it for all variables? Deepak