ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
djrisks
Barite | Level 11

Hello,

I've outputted an Excel file using SAS. This is the first image below. I will like the highlighted text in yellow to still wrap and be on multiple lines (for better viewing), but not add an carriage return. The yellow highlighted text in the second image shows what I would like, such as the text is wrapped and on multiple lines, and when you look in the top menu, you can see that there is no carriage return in the text. But, the second image is creating in Excel. Do you have any ideas how I can do this in SAS please? The proc report code that I have been using is below too, and the dataset that is being used has been attached. 

Excel Example.PNGHow I want it Excel Example.PNG

 

ods excel file="&export" ods excel options(flow="tables" sheet_name="QSORRES Mapping" absolute_column_width = "22, 23, 16, 60, 60, 13, 60, 65");
ods escapechar='~';
proc report data=input_data nowd spanrows wrap style(header)={textalign=left /*fontsize=10pt fontweight=bold*/ /*fontfamily="Albany AMT"*/} style(column)={textalign=left /*fontsize=10pt  *//*fontfamily="Albany AMT"*/};
     column ('~S={foreground=black}Raw'  FORMNAME_TEST FORMNAME_PRODUCTION ITEMNAME VALUE)  
            ('~S={foreground=black}SDTM' QSORRES QSSTRESN QSSTRESC Comments_Special_characters_);
     define FORMNAME_TEST / "FormName Test" display style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define FORMNAME_PRODUCTION / "FormName Production" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define ITEMNAME / "ItemName" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define VALUE / "Value" style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#E2EFDA foreground=black};

     define QSORRES / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=D9E1F2} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESN / format=8. style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESC / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#D9E1F2 foreground=black};
     define Comments_Special_characters_/ "Comments (Special characters)" style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};     
run;

ods excel close;

 

Thank you!

 

4 REPLIES 4
djrisks
Barite | Level 11

Actually, this is the code:

 

ods excel file="&export"  options(flow="tables" sheet_name="QSORRES Mapping" absolute_column_width = "22, 23, 16, 60, 60, 13, 60, 65");
ods escapechar='~';
proc report data=input_data nowd spanrows wrap style(header)={textalign=left /*fontsize=10pt fontweight=bold*/ /*fontfamily="Albany AMT"*/} style(column)={textalign=left /*fontsize=10pt  *//*fontfamily="Albany AMT"*/};
     column ('~S={foreground=black}Raw'  FORMNAME_TEST FORMNAME_PRODUCTION ITEMNAME VALUE)  
            ('~S={foreground=black}SDTM' QSORRES QSSTRESN QSSTRESC Comments_Special_characters_);
     define FORMNAME_TEST / "FormName Test" display style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define FORMNAME_PRODUCTION / "FormName Production" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define ITEMNAME / "ItemName" style(column)={vjust=c} style(header)={background=#E2EFDA foreground=black};
     define VALUE / "Value" style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#E2EFDA foreground=black};

     define QSORRES / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=D9E1F2} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESN / format=8. style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESC / style(column)={vjust=c tagattr='wraptext:yes' width=100%} style(header)={background=#D9E1F2 foreground=black};
     define Comments_Special_characters_/ "Comments (Special characters)" style(column)={vjust=c} style(header)={background=#D9E1F2 foreground=black};     
run;

ods excel close;
Patrick
Opal | Level 21

Below seems to get the wrapping right.

ods excel 
  file="&export"  
  options(flow="tables" sheet_name="QSORRES Mapping");
ods escapechar='~';
proc report data=input_data nowd spanrows wrap style(header)={textalign=left /*fontsize=10pt fontweight=bold*/ /*fontfamily="Albany AMT"*/} style(column)={textalign=left /*fontsize=10pt  *//*fontfamily="Albany AMT"*/};
     column ('~S={foreground=black}Raw'  FORMNAME_TEST FORMNAME_PRODUCTION ITEMNAME VALUE)  
            ('~S={foreground=black}SDTM' QSORRES QSSTRESN QSSTRESC Comments_Special_characters_);
     define FORMNAME_TEST / "FormName Test" display style(column)={vjust=c width=22em} style(header)={background=#E2EFDA foreground=black};
     define FORMNAME_PRODUCTION / "FormName Production" style(column)={vjust=c width=23em} style(header)={background=#E2EFDA foreground=black};
     define ITEMNAME / "ItemName" style(column)={vjust=c width=10em} style(header)={background=#E2EFDA foreground=black};
     define VALUE / "Value" style(column)={vjust=c width=16em} style(header)={background=#E2EFDA foreground=black};

     define QSORRES / style(column)={vjust=c tagattr='wraptext:yes' width=60em} style(header)={background=D9E1F2} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESN / format=8. style(column)={vjust=c width=13em} style(header)={background=#D9E1F2 foreground=black};
     define QSSTRESC / style(column)={vjust=c width=10em} style(header)={background=#D9E1F2 foreground=black};
     define Comments_Special_characters_/ "Comments (Special characters)" style(column)={vjust=c width=65em} style(header)={background=#D9E1F2 foreground=black};     
run;

ods excel close;
djrisks
Barite | Level 11

Thank you for your response. Unfortunately, I still get the issue with the values being squashed and not immediately appearing in multiple lines within Excel. Please see the example below. Do you know how to overcome this? 

 

Text Wrap Issues.PNG

 

Many thanks,

 

Kriss

Patrick
Opal | Level 21

The code I've posted works for me. Below how the Excel looks like in my environment.

Patrick_0-1634077757395.png

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1385 views
  • 0 likes
  • 2 in conversation