BookmarkSubscribeRSS Feed
ChrisNZ
Tourmaline | Level 20

Here is a table with variables that contain values of random lengths and random number of lines. 
Q: Is there a way to export this to Excel from SAS so all values are visible inside a cell?

No wrapping, one line per value, cell width not that important.

It seems that ever since option autofit_height  was removed, nothing works?
The EOL delimiter can be changed

data HAVE;
  x = catx( '0D0A'x, '0000000000', '4445566778','9999999999','9991123456'); 
run;

ods excel file="&wdir\print.xlsx" options(sheet_name='Test');          
  proc print data=HAVE noobs ;
  run;
ods excel close;

Setting cellwidth to force line wrapping as sometimes suggested does not look like a solution since it breaks lines randomly rather than where required.

 

1 REPLY 1
Ksharp
Super User

Chris,

You could try option "tagattr=“ to avoid  wrapping  a line when you want to outpu an excel file.

Here is an example:

 

data HAVE;
  x = catx( '0D0A'x, '0000000000', '4445566778','9999999999','9991123456'); 
run;

ods excel file="c:\temp\print.xlsx" options(sheet_name='Test');          
  proc report data=HAVE nowd ;
  columns x;
  define _all_/display style={tagattr="wrap:no"};
  run;
ods excel close;

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 99 views
  • 0 likes
  • 2 in conversation