Help using Base SAS procedures

proc export truncates label name

Reply
Super Contributor
Posts: 318

proc export truncates label name

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;

Super User
Posts: 17,818

Re: proc export truncates label name

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.

Super User
Posts: 9,676

Re: proc export truncates label name

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

Ask a Question
Discussion stats
  • 2 replies
  • 445 views
  • 0 likes
  • 3 in conversation