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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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