I have this script below. When the excel file is generated the field reporting_quarter actually gets truncated and only "Reportin" is displayed. Any ideas how to overcome the issue? Thanks!
data tmp;
attrib memberno label="Member_No" length=$11 format=$11. informat=$11.;
attrib previous_risk_category label="Previous Risk Category" length=$11 format=$11. informat=$11.;
attrib current_risk_category label="Current Risk Category" length=$11 format=$11. informat=$11.;
attrib previous_risk_score label="Previous Risk Score" length=8 format=best32. informat=best32.;
attrib current_risk_score label="Current Risk Score" length=8 format=best32. informat=best32.;
attrib reasons label="Reasons" length=$250 format=$250. informat=$250.;
memberno="1111111111";
previous_risk_category="Elevated";
current_risk_category="High";
previous_risk_score=5;
current_risk_score=7;
reasons="abcd[0,2];";
attrib reporting_quarter length=$20 format=$20. informat=$20.;
reporting_quarter=put("31mar2014"d,yyq6..);
run;
EDIT: Will simply adding the label for reporting_quarter fix the issue? Thanks!
proc export
outfile="C:\excelout.xls"
dbms=excel4 replace label;
run;
Try changing your DBMS as well, if label doesn't work.
Try Excel as a starter.
Label is a SAS 9.2+ feature at least I think, so if you're on 9.1 you may be out of luck.
It is weird . I am not getting any truncated problem.
data tmp; attrib memberno label="Member_No" length=$11 format=$11. informat=$11.; attrib previous_risk_category label="Previous Risk Category" length=$11 format=$11. informat=$11.; attrib current_risk_category label="Current Risk Category" length=$11 format=$11. informat=$11.; attrib previous_risk_score label="Previous Risk Score" length=8 format=best32. informat=best32.; attrib current_risk_score label="Current Risk Score" length=8 format=best32. informat=best32.; attrib reasons label="Reasons" length=$250 format=$250. informat=$250.; memberno="1111111111"; previous_risk_category="Elevated"; current_risk_category="High"; previous_risk_score=5; current_risk_score=7; reasons="abcd[0,2];"; attrib reporting_quarter length=$20 format=$20. informat=$20.; reporting_quarter=put("31mar2014"d,yyq6..); run; proc export outfile="C:\temp\excelout.xls" dbms=excel replace ; label; run;
Xia Keshan
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.