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.
Answer Posted / 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 |
Post New Answer View All Answers
what is the difference between: x=a+b+c+d; and x=sum (of a, b, c ,d);? : Sas programming
If you have a dataset that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables?
Which date function advances a date, time or datetime value by a given interval?
What are the different versions of sas that you have used until now? : sas-grid-administration
what are several options for creating reports in web report studio? : Sas-bi
What is the difference between input and infile statement?
How do dates work in SAS data?
I need level 2 to 5 sas using companies in india
What are the special input delimiters used in SAS?
what is sas application server? : Sas-di
What are the data types that sas contain?
What are the statements in proc sql?
What are the differences between proc means and proc summary?
Give some examples where proc report’s defaults are same as proc print’s defaults?
How do you use the do loop if you don’t know how many times you should execute the do loop?