BookmarkSubscribeRSS Feed
ashna
Obsidian | Level 7

Hi Everyone,

 

I'm creating a report using Proc report . Everything is working perfectly except the following,

 

I have Variable with Observations having "–" (eg:R – Activate jack ) . when I'm export this variable using Proc report to excel, it is writting as "?"

 

Can any one suggest how to get "–" return to output report file.

 

Any help is appreciated. 

 

Thanks

1 REPLY 1
JaneEslinger
SAS Employee

Hi,

I copied the text you used in your post.  The Excel file contains the dash.  Since I was unable to replicate your results I decided to take a look at the hex representation of the value.  

 

 

data a;
a='R – Activate jack';
put a hex20.;
run;

 

 

The log gives this value:  52209620416374697661

The third value is 96 (3rd character), which is the hexadecimal representation of a dash.  I recommend that you look at one of your observations that contains the dash and see if you get a hex value of 96 as well.  I suspect that maybe you don't have a true dash.  Either the encoding of your SAS session or the font being used does not know how to display the value you do have, so you get a question mark.  

 

You will need to modify the data to contain a character that can be displayed properly.  If trying to determine what exact character you have seems daunting, you could swap out the character you do have with the UNICODE function, specifying the Unicode value for dash.  Simply copy the dash you see in the data and paste it as the second argument in the TRANWRD function.  

 

data a;
a='R – Activate jack';
b = tranwrd(a,'–','^{unicode 2013}');
run;

ods escapechar="^";
ods excel file='test.xlsx';
...

 

SAS Technical Support is a resource.  You can submit a track here and one of the consultants can help you debug further.  Be sure to provide at least one record of data that contains the character.

 

Jane

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 709 views
  • 0 likes
  • 2 in conversation