BookmarkSubscribeRSS Feed
PhilC
Rhodochrosite | Level 12

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;
3 REPLIES 3
LaurieF
Barite | Level 11

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

 

    VAR edu/ style=[tagattr='wraptext:no' width=100%];
PhilC
Rhodochrosite | Level 12

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.

PhilC
Rhodochrosite | Level 12
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.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 3942 views
  • 1 like
  • 2 in conversation