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 / schuler
data formated(keep=datenew);
length datenew $10.;
set new;
if date<'31dec1974'd then datenew=put(date,date7.);
else if date>'31dec1984'd then datenew=put(date,date7.);
else datenew='Disco Year';
run;
proc print data=formated nobs;run;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which are the statements whose placement in the data step is critical?
data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.
How will you use the WHO Drug Dictionary for Reporting Clinical Trials?
what is the use of proc sql? : Sas programming
What is the difference between match merge and one to one merge?
is data integration and etl programming is same? : Sas-di
What is the maximum length of the macro variable? : sas-macro
What is the length assigned to the target variable by the scan function?
how sas deals with business intelligence? : Sas-bi
Mention the difference between ceil and floor functions in sas?
how does sas handle missing values in formats? : Sas programming
What areas of SAS are you most interested in?
what is program data vector? : Sas-administrator
Did you used proc test? when?
what is study design in while working with SAS? what are screening variables in SAS?