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 / amit gupta
Apologies,
above code has an extra "FROM d1"
The working code is as below:
proc sql;
select
case when date lt '31DEC2006'd then date end as mydate
format=date7. ,
case when date gt '31DEC2008'd then date end as mydate
format=date9. ,
case when '01JAN2007'd <= date <= '31DEC2008'd then 'DUMMY'
end as mydate
from d1 ;
quit;
However it does give the data in 3 columns , which I was
unable to merge as the data type was different.
Any working solution using format ?
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
what is the effect of the options statement errors=1? : Sas programming
What is the difference between proportion and average?
why is sas considered self-documenting? : Sas programming
What is the use of %include statement?
How do dates work in SAS data?
i want for interview question & answer plz it need immediate send t my mail raviprakashmot@gmal.cm
What is the difference between the proc sql and data step?
Explain by-group processing?
What are the difference between ceil and floor functions in sas?
What are all the problems you faced while validating tables and reports?
Mention the category in which sas informats are placed?
What is maximum number of rows and cols can be handled in SAS?
Hi Friends, Am Priya,new to your forum. am looking for Interview questions on SAS Platform Administration. I searched everywhere but I couldn't find them,please can anyone help me with complete interview questions normally everyone will face in the interviews on SAS Administration. am really facing problems in the interviews,am not able to answer any of their questions. I would really appreciate all your help if you can email the complete Interview Questions to priyafeb84@gmail.com Kindly awaiting for your reply with eager
Mention the validation tools used in SAS?
What is the difference between reading data from an external file and reading data from an existing data set?