BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BruceKayton
Fluorite | Level 6

A simplified version of my code is as follows:

 

/* Escapechar is ^ */


ods excel options (sheet_name="&table" sheet_interval="none" embedded_titles='yes');
title1 "&title";
proc report data=pk3 nowd missing split='@';
col subjectid ('Nominal time post-dose (h)' tp0 'tp0.5'n tp1 tp2 tp3 tp4 tp5 tp8) result_min result_max t_max auc_sum;
define subjectid / 'Subject ID' order;
define result_min / "C^{sub min}@(ng/mL)";
define result_max / "C^{sub max}@(ng/mL)";
define t_max / "t^{sub max}@(h)";
define auc_sum / "AUC^{sub 0-8}@(h&dot.ng/mL)";
run;

 

The header in the output shows:

Subject ID00.5123458Cmin(ng/mL)Cmax(ng/mL)tmax(h)AUC0-8(h▪ng/mL)

 

Split character is being ignored. I have seen in the post below that this is a known issue. 

https://communities.sas.com/t5/ODS-and-Base-Reporting/Line-not-wrapping-in-ODS-Excel/m-p/324326/high...

 

Is there a work around? I've tried ^{newline}, inserting '0A'x to no avail. Is there RAW code as in RTF that I could insert for Excel to render?

 

Thanks in advance

 

Bruce Kayton 

1 ACCEPTED SOLUTION

Accepted Solutions
SuzanneDorinski
Lapis Lazuli | Level 10

I'm using SAS University Edition, running SAS 9.4M6.  

 

The split character works, but you need to make sure there's a space before it.  See the example code below.

 

ods escapechar='^';

%let dot=^{unicode 2022};

ods excel file="/folders/myfolders/ODS Excel examples/split_characters_PROC_REPORT.xlsx";

* need to have space before split character below.  does not work as expected
* if you do NOT include the space! ;

proc report data=sashelp.class nowd missing split='@';
  col name age height sex weight;
  define name / 'Subject@ID' order;
  define age / "C^{sub min} @(ng/ml)";
  define height / "C^{sub max} @(ng/ml)";
  define sex / "t^{sub max} @(ng/ml)";
  define weight / "AUC^{sub 0-8} @(h&dot.ng/ml)";
run;

ods excel close;

The output:

Need a blank before the split character in PROC REPORT with ODS Excel destination if also using other techniquesNeed a blank before the split character in PROC REPORT with ODS Excel destination if also using other techniques

Edited to add:  ODS TAGSETS.EXCELXP and ODS EXCEL SHOWDOWN was the first result I got when searching on "sas ods excel destination split character".  The examples in that paper show the split character with regular text.  

View solution in original post

9 REPLIES 9
Reeza
Super User
Since this is one of the newer features, I suspect your SAS version will be important. What version of SAS are you using? You can find out by using the following code, the output is in the log.

proc product_status;run;
BruceKayton
Fluorite | Level 6

Version is 9.4_M3, but that is irrelevant. If I use the RTF destination it works just fine, output is required in Excel. ExcelXP tagset works too, but I lose some other features with that. Definitely an ODS Excel destination issue.

Reeza
Super User
ODS EXCEL was implemented only as production in 9.4M3 and it has some bugs still in that version. 9.4M5, is more stable. This type of behaviour can also be destination dependent because different file types use a different method to specify a new line or subscript, so there are definitely variations in the output across different destination types.

If you can provide some sample data I can test your code on SAS 9.4 TSM5 to see if it's fixed or not.
ballardw
Super User

Will the values under the column work if you specify a width for the column heading that forces a wrap (may want FLOW in the define). You might need one or two spaces instead of your split character.

 

Perhaps instead of the SUB you might be able to create similar text with Unicode characters.

BruceKayton
Fluorite | Level 6

Tried those. none of those work. FLOW really only applies to the column content, not the header.

 

SuzanneDorinski
Lapis Lazuli | Level 10

I'm using SAS University Edition, running SAS 9.4M6.  

 

The split character works, but you need to make sure there's a space before it.  See the example code below.

 

ods escapechar='^';

%let dot=^{unicode 2022};

ods excel file="/folders/myfolders/ODS Excel examples/split_characters_PROC_REPORT.xlsx";

* need to have space before split character below.  does not work as expected
* if you do NOT include the space! ;

proc report data=sashelp.class nowd missing split='@';
  col name age height sex weight;
  define name / 'Subject@ID' order;
  define age / "C^{sub min} @(ng/ml)";
  define height / "C^{sub max} @(ng/ml)";
  define sex / "t^{sub max} @(ng/ml)";
  define weight / "AUC^{sub 0-8} @(h&dot.ng/ml)";
run;

ods excel close;

The output:

Need a blank before the split character in PROC REPORT with ODS Excel destination if also using other techniquesNeed a blank before the split character in PROC REPORT with ODS Excel destination if also using other techniques

Edited to add:  ODS TAGSETS.EXCELXP and ODS EXCEL SHOWDOWN was the first result I got when searching on "sas ods excel destination split character".  The examples in that paper show the split character with regular text.  

BruceKayton
Fluorite | Level 6

Must be version related then, because that still doesn't work for me. I'm running SAS 9.4M3

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 9 replies
  • 2103 views
  • 5 likes
  • 4 in conversation