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

Does anyone know how to output 'equal to' sign to excel file using ODS tagsets.

 

compute equalsign2 / character length=2;
     equalsign2 = "=";
endcomp;

 

This does not work because it considers it to be a formula

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

How about this :

 

ods tagsets.excelxp file='c:\temp\xyz.xml';
proc report data=sashelp.class nowd;
column name age equalsign ;
define name/display;
define age/display;
define equalsign /computed;
compute equalsign / character length=4 ;
   equalsign = '09'x||'=';
endcomp;
run;
ods tagsets.excelxp close;

View solution in original post

11 REPLIES 11
FreelanceReinh
Jade | Level 19

Have you tried this?

equalsign2 = "'=";

(I'm only guessing. I don't have Excel installed on my SAS workstation.)

 

Sanjay_M
Obsidian | Level 7

yes i have. but then when i open the excel file it appears as '=

 

the sign quote disapears only when you go to that cell and move out of it

FreelanceReinh
Jade | Level 19

What will be the purpose of the equals sign in the Excel cell, if not the beginning of a formula?

 

My Excel 2013 accepts a (manually entered) single equals sign without any problem. Therefore, I assume that in your case there will be some text to the right of the equals sign (a combination which would indeed be interpreted as a formula). Is this true?

 

An expression like " =abc" (without quotation marks, but with a leading blank) does not seem to be interpreted as a formula. Would this be an option?

Sanjay_M
Obsidian | Level 7

The purpose of puting the equal to sign is to display 2 + 2 = 4

 

I need to display this statement as it is.

 

2

+

2

=

4

 

they all are in different cells and there is no text after the equal as you see in the example given

FreelanceReinh
Jade | Level 19

Thanks for the clarification. What exactly is the issue (e.g. error message) when you put the single equals sign into a cell?

 

If the " =" (equals sign preceded by a space) is not acceptable for you, we could try a variety of other ASCII characters (from the code range 0, ..., 31) as replacements for the space (ASCII 32). I've just written all of these together with an equals sign into individual cells of an Excel sheet and several of them seem to be totally invisible (i.e. do not even appear as a blank space to the left of the equals sign, neither in Excel, nor in Notepad). ASCII 31 (hex 1F) is one of these. So, maybe this would be a candidate:

equalsign2 = '1F3D'x;

('3D'x is the equals sign in hexadecimal notation.)

Sanjay_M
Obsidian | Level 7

Thank you for your support.

 

Below is the message output to a log file. I'm using SAS University Edition.

Actually it is considering the equal sign as the beginning of a formula.

 

compute equalsign / character length=4 ;
                                 equalsign = '3D'x;
endcomp;

 

XML Spreadsheet Warning in Table
REASON: Bad Value
FILE: C:\Myfile.xls
GROUP: Row
TAG: Cell
ATTRIB: Formula
VALUE: =

 

 

 

FreelanceReinh
Jade | Level 19

Ok, I see. Have you tried '1F3D'x (or '1E3D'x or '1D3D'x or ...)?

Sanjay_M
Obsidian | Level 7

YES JUST TRIED THANKS.

 

USING THESE 3, IT DISPLAYED

 

?=

Sanjay_M
Obsidian | Level 7

going to bed now, will catch ya tomorrow

thanks a million.

Ksharp
Super User

How about this :

 

ods tagsets.excelxp file='c:\temp\xyz.xml';
proc report data=sashelp.class nowd;
column name age equalsign ;
define name/display;
define age/display;
define equalsign /computed;
compute equalsign / character length=4 ;
   equalsign = '09'x||'=';
endcomp;
run;
ods tagsets.excelxp close;
Sanjay_M
Obsidian | Level 7

That worked beautifully

 

Thanks a lot.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 11 replies
  • 2000 views
  • 1 like
  • 3 in conversation