BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

I am downloading an xml file from an api website. Then I am creating a mapfile but I getting conversion errors due to the presence of emoji into the xml file.

I have used a perl script to remove the emoji from the xml file, but now, I am getting these  errors:

 

ERROR: The creation of the XML Mapper file failed.
ERROR: Error in the LIBNAME statement.

 

/********** Creating the map file ***************/

%let file_path=/finsys/...;
%let xmlFile2=VirageSurvey.xml;
%let xmlMap2=VirageSurvey.map;

%put &=file_path.;
%put &=xmlFile2.;
%put &=&xmlMap2.;

filename datafile "&file_path./&xmlFile2." encoding='utf-8';
%put %sysfunc(pathname(datafile));
filename mapfile "&file_path./&xmlMap2.";
%put %sysfunc(pathname(mapfile));

libname datafile xmlv2 automap=replace xmlmap=mapfile compat=yes;

What's can be done to solve this issue.

3 REPLIES 3
andreas_lds
Jade | Level 19

Should work, if the sas session uses utf-8 encoding.

alepage
Barite | Level 11
Is there a way to check if the UTF8 encoding is effective. Can we add more options to help in the troubleshooting
Tom
Super User Tom
Super User

It is probably more important to make sure your SAS session is using UTF-8 than it is to tell SAS what encoding to use for individual files.  SAS can usually detect the encoding of a file it is reading. But if the session is not using UTF-8 encoding and you try to read in a character from an UTF-8 encoded file that is not one of the 256 characters that exist in the singly byte encoding you are using to run SAS then it can cause loss of data (or worse).

 

To check if SAS is running with UTF-8 encoding check the value of the ENCODING system option.  You could use PROC OPTIONS.

proc options option=encoding;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 471 views
  • 0 likes
  • 3 in conversation