BookmarkSubscribeRSS Feed
milts
Pyrite | Level 9

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;

2 REPLIES 2
Reeza
Super User

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.

Ksharp
Super User

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

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2007 views
  • 0 likes
  • 3 in conversation