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 can be the size of largest dataset in SAS?
How do you define proc in sas? : sas-grid-administration
Hi,by usining ptf how we have to combine (likr merge)10 datasets at a time in the oracle database(and write a macro code also)?Like this i have a douts a lot if you dont mind may please send one text mail for me(madhusudhanap16@gmail.com)?
What are the five ways to do a table lookup in sas? : sas-grid-administration
Why and when do you use proc sql?
what do the pad and dim functions do? : Sas programming
What is the difference between %local and %global? : sas-macro
What are symget and symput? : sas-macro
How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?
What is the difference between match merge and one to one merge?
List out some key concept of SAS
Tell e how how dealt with..
for report generation which one you used proc report or data_null_?
what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming
Do you know the features of sas?