Hi, I havea data format as such MMDDYYP10. (samples below), I'm trying to get the months out of the dat but in a MONNAME. format.
Have
Date
05.02.2012
06.14.2012
07.04.2012
I used
Date_A = Month (Date);
Format Date_A MONANME. but this didn't quite work
Want
Date_B
May
June
July
The monname format uses a date variable not a month variable.
so
date_a=date;
format date_a monname10.;
or
format date monname10.;
Thank you
Hi Reeza, when I export it to Excel the date_a doesn't come across as only Month , but as the whole date similar to date. In SAS it shows correct, how I would like it to.
You exported the data with proc export?
By definition SAS does not export formats to Excel using proc export.
Instead you can create a new variable using the put statement that will recode the data and then export.
data_a=put(date, monname10.);
Hi.
PROC EXPORT does not keep formats, but the ODS tagsets does.
Below is a sample code that will keep ALL your formats.
ods listing close;
ods tagsets.excelxp path = "&output_path." file="&data..xml"
style=analysis options(absolute_column_width='10,10,8,8,10,10,15,8,15,8,15,10,8,8,8,8,10,10,15,8,15,8,15,10,8,8,8,8,20'
sheet_label=' ');
ods tagsets.excelxp options(sheet_name="sheetname");
proc print noobs label data = &data.;
var your_variables;
run;
ods tagsets.excelxp close;
ods listing;
Good luck!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.