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.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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