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 |
What are symbol tables?Differemce between Local N Global Symbol tables.....
What are the different versions of sas that you have used until now? : sas-grid-administration
what is scheduling and how will u implement it. In scheduling 5 jobs r running if there is an error occured at 3rd job and how will u check and waht necessary steps will u take not to repeat the same mistake
%STPbegin;%STPEND; ERROR: No logical assign for filename _WEBOUT. WARNING: No body file. HTML output will not be created. unable to fix it.plz help
If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record?
Hi, If anyone has base SAS certification dumps, please share.
what kind of variables are collected in AE dataset?
3 Answers Accenture, Quintiles, SAS,
what is SAS OPTIMIZATION?
How do you debug macros?
what type of graphs we will create(for 2+years candidates)?
is data integration and etl programming is same? : Sas-di
what is intially documentation for a sas programmer?