Thursday, April 30, 2009

Assigning multiple formats to one variable depending on its value using PROC FORMAT


proc format;
value mydates
'1Jan2009'd - '31jan2009'd = [mmddyy8.]
'1feb2009'd - '28feb2009'd = [date7.]
;
run;


data dates;
first = '15jan2009'd ; output;
first = '15feb2009'd; output;
format first mydates.;
run;
proc print;
run;

No comments:

Post a Comment