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
proc sql;
select
case when date lt '31DEC2006'd then date end as mydate
format=date7. from d1
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;
Just that these are in three different columns;
Tried the above resolutions but unsuccessfully.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Of all your work, where have you been the most successful?
i have a dataset with 100 obs i want to generate title from 20th obs onwards with total observations. that should contain 100 obs.dont use firstobs and dnt split the data. use dataset block or proc report? how can we genarate;
How do you use the do loop if you don’t know how many times you should execute the do loop?
How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?
how many types prompting framework can be broken down to? : Sas-bi
What function CATX syntax does?
Can you execute macro within another macro? : sas-macro
How will you generate test data with no input data?
I am preparing SAS Certified Advanced Programmer for SAS 9 in 2014. If anybody has the latest dumps for this exam, please mail me at dhiman.mukherjee@gmail.com
Do you need to compute new variables? If so,should you do this before you execute the report-writing procedure?
How to create a permanent sas data set?
what is the one statement to set the criteria of data that can be coded in any step? : Sas programming
What would be the value of month at the end of data step execution and how many observations would be there?
What is the maximum length of the macro variable? : sas-macro
How would you invoke a macro? : sas-macro