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.
Should work, if the sas session uses utf-8 encoding.
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;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.