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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
BenConner
Pyrite | Level 9

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

 

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

3 REPLIES 3
Cynthia_sas
Diamond | Level 26

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

BenConner
Pyrite | Level 9

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

BenConner
Pyrite | Level 9

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

 

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

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3 replies
  • 2190 views
  • 0 likes
  • 2 in conversation