The SAS Output Delivery System and reporting techniques

Inline formatting swallows a space when going to Excel

Accepted Solution Solved
Reply
Regular Contributor
Posts: 179
Accepted Solution

Inline formatting swallows a space when going to Excel

Hi,

 

I'm testing applying formatting to parts of a data line when generating an Excel spreadsheet.  The sample code below looks fine going to html but not to Excel--the 2nd test line has the space before Test drop out.

 

Can anyone shed light on why this might be happening?

 

Thanks!

 

--Ben

 

%let path=c:\temp\;
proc format;
value $dumbplan 'Second Test' = 'Second^{style[fontstyle=italic] Test}';
run;


data text;
input line $70.;
format line $dumbplan.;
cards;
First Test
Second Test
Third Test
;;;

ods escapechar='^';
ods excel
options(sheet_name='Test' sheet_label=' ')
file="&path.mytest.xlsx";

proc print data=text;
id line;
run;

ods excel close;


Accepted Solutions
Solution
‎07-02-2017 12:18 PM
Regular Contributor
Posts: 179

Re: Inline formatting swallows a space when going to Excel

Posted in reply to BenConner

T.S. responded; this is a defect.  With a cool workaround. Smiley Happy

 

proc format;

value $dumbplan 'Second Test' = 'Second^{style[fontstyle=italic] ^{nbspace 2} Test}';

run;

 

Using the non-breaking space code will take care of it.

 

Is SAS doing 24x7 T.S. now??  Impressive.

 

--Ben

 

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,862

Re: Inline formatting swallows a space when going to Excel

Posted in reply to BenConner

Hi, Ben:

  I do observe this behavior when using SAS 9.4 and ODS EXCEL (losing the space between words). I don't know why it's happening, but it seems to me that you've run across something to be reported to Tech Support. I do NOT lose the space in the default HTML destination or in TAGSETS.EXCELXP. And, it doesn't seem to matter whether I make the variable in an assignment statement or using the format. As you can see, I changed your program a bit as a test.

 

cynthia

 

diff_behavior.png

Regular Contributor
Posts: 179

Re: Inline formatting swallows a space when going to Excel

Posted in reply to Cynthia_sas

Thanks, Cynthia!  Will run it by the TS folks and see what they say.  I'll post a final comment here after they track it down.

 

Much appreciated!

 

--Ben

Solution
‎07-02-2017 12:18 PM
Regular Contributor
Posts: 179

Re: Inline formatting swallows a space when going to Excel

Posted in reply to BenConner

T.S. responded; this is a defect.  With a cool workaround. Smiley Happy

 

proc format;

value $dumbplan 'Second Test' = 'Second^{style[fontstyle=italic] ^{nbspace 2} Test}';

run;

 

Using the non-breaking space code will take care of it.

 

Is SAS doing 24x7 T.S. now??  Impressive.

 

--Ben

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 299 views
  • 0 likes
  • 2 in conversation