The SAS Output Delivery System and reporting techniques

ODS EXCEL, PROC TABULATE, line wrapping question

Reply
Regular Contributor
Posts: 152

ODS EXCEL, PROC TABULATE, line wrapping question

Can any one explain a work around to this issue where the wraptext:no ( or wrap:no) style attribute does not stop ODS EXCEL from wrapping fields (i.e. inserting line feeds).

 

proc format;
  value EDUCLAM
    16 = '4 YEARS OF COLLEG 4 YEARS OF COLLEGE'
    17 = '1 YEAR OF GRAD SC 1 YEAR OF GRAD SCHOOL'
    18 = '2 YEARS OF GRAD S 2 YEARS OF GRAD SCHOOL'
    19 = '3 YEARS OF GRAD S 3 YEARS OF GRAD SCSCHOOL'
    20 = '4 OR MORE YEARS O 4 OR MORE YEARS OF GRAD SCHOOL'
  ;
run;

data nowrap;
  infile datalines;
  input edu;
  format edu EDUCLAM.;
datalines;
16
17
20
;
run;

ods excel file="d.xlsx";
  PROC TABULATE DATA=WORK.NOWRAP ;
    VAR edu/ style=[tagattr='wraptext:no'];
/*    VAR edu/ style=[tagattr='wrap:no'];*/
    TABLE edu,(min Median max)*F=EDUCLAM.;
  run;
ods excel close;
Regular Contributor
Posts: 249

Re: ODS EXCEL, PROC TABULATE, line wrapping question

I'm no ODS maven, but this gets closer:

 

    VAR edu/ style=[tagattr='wraptext:no' width=100%];
Regular Contributor
Posts: 152

Re: ODS EXCEL, PROC TABULATE, line wrapping question

[ Edited ]

Seems like we're giving SAS a reason not the wraplines rather than it not wrapping lines because we used tagattr='wraptext:no'?  Indeed, it *is* closer; I can see now that I can force the column widths with the ODS statement.  It's not very satisfying, but thanks for the response.

Regular Contributor
Posts: 152

Re: ODS EXCEL, PROC TABULATE, line wrapping question

[ Edited ]
VAR edu/ style=[width=100%];

@LaurieF, right, just tried it with this line.  If one uses no wraptext style command but one uses the width command, same result, no wrapping occurs.  What's happening is that no line feeds are being added to the lines of text.  This is a forced line wrapping imposed by the ODS system (maybe?) before Excel appies its own wrapping.

 

Post a Question
Discussion Stats
  • 3 replies
  • 138 views
  • 1 like
  • 2 in conversation