Hello SAS guys,
When I import the excel file into SAS, the SAS dataset has some special charater string beginning with &#, which the excel file don't have, such as " " ,"&# 8875;", "’". How can I delete those unwanted strings. It seems there is nothing strange with excel file, however these special string shows up between the space of two words instead of blank space. Any idea is appreciated.
my SAS data is :
var1
Newton’s seconde law for particles
Newtow’s first law for particales
Region 1
13. Basic Math
4.Instruction and#&8875; Concepts
7.Vibratons#&8875;knowledge
What method did you use to import the data? What version of SAS are you using.
I think this issue of some unicode characters being stored this way was fixed in a recent update.
You can just use TRANWRD() function to convert them.
160 (or 'A0'x) is a "non-breaking" space. So just replace it with a space.
8217 is a curly single quote. I would just replace it with a normal single quote.
Hi Tom,
I use SAS 9.4(TS1M3). The import code is proc import datafile="datadir\excelfilename.xlse" out=have dbms=xlsx replace;
getnames=no;
run;
Thanks for answering the question
Thank you Cynthia_sas. How can I convert the excel file to a unicode font? The format cells option in excel do not provide unicode choice.
Thank you very much. It works.
data _null_;
x='Newton’s seconde law for particles';
x=htmldecode(x);
put x=;
run;
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.
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.