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
SAS Super FREQ

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

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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