BookmarkSubscribeRSS Feed
OS2Rules
Obsidian | Level 7
Hi All:

I have some data that I am printing to Excel using the ExcelXP Tagset.

Unfortunately, there is 1 record in the data (a text field) that can have an equal sign ("=") as the first character. This causes an error in the table (I'm using PROC REPORT) because Excel thinks that the field is a formula and not data.

I tried the: tagattr='format:@' to force the field to be text, but Excel still thinks that it is a formula.

Any thoughts on how I can get around this (without translating the input field I mean)?

Thanks in advance.
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:

My tendency would be to translate the '=' to something like ~ (tilde) or - (dash) or use ods escapechar to insert a unicode symbol into the text string....if the = wasn't required. or, put some text string in front of the whole field like
COMMENT: = or
NOTE: = or
X = or even
| =
I don't know whether inserting an "unprintable" character would work, but that might be something else to try -- on the other hand, Excel might just ignore the unprintable character.


Does the equal sign serve any meaningful purpose??? If forcing the field to be text doesn't work and you really, really need the = to be maintained, then you might really need to work with Tech Support on this question.

Excel has its own way of dealing with cell values and I'm not sure how you get around this one. To send a question to Tech Support, go to http://support.sas.com/ and in the left-hand navigation pane, click on the link entitled "Submit a Problem". Alternately, you can go directly to the Tech Support Problem Form here:
http://support.sas.com/ctx/supportform/createForm

cynthia
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Append a leading single-quote character to your SAS variable (using an assignment statement) to cause Excel to treat the cell as TEXT, regardless of content. You will need to consider the SAS variable length and increase by +1 to accommodate the additional prefix-character.

Scott Barry
SBBWorks, Inc.

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