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


Please Help Members By Posting Answers For Below Questions

what is the effect of the options statement errors=1? : Sas programming

793


What is the difference between proportion and average?

2992


why is sas considered self-documenting? : Sas programming

857


What is the use of %include statement?

813


How do dates work in SAS data?

899


i want for interview question & answer plz it need immediate send t my mail raviprakashmot@gmal.cm

2122


What is the difference between the proc sql and data step?

868


Explain by-group processing?

781


What are the difference between ceil and floor functions in sas?

1037


What are all the problems you faced while validating tables and reports?

3221


Mention the category in which sas informats are placed?

801


What is maximum number of rows and cols can be handled in SAS?

1060


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

1833


Mention the validation tools used in SAS?

841


What is the difference between reading data from an external file and reading data from an existing data set?

889