Hello,
I am using a proc http procedure to download an xml file on a unix server and that part goes well.
The issue is when I am trying to import this xml file into a SAS data set, it failed because some variables length are longer than 32 characters. How to solve that issue?
title1 'Reading the XML File Survey Response';
libname in xml "/.../LEGO_3064_Broker_Virage/Surveys/Virage_Survey.xml";
data SurveyResponse;
set in.Virage_Survey ;
run;
title2 'check parsing of file';
proc print data=SurveyResponse;
run;
proc contents data=SurveyResponse;
run;
NOTE: Libref IN was successfully assigned as follows: Engine: XML Physical Name: /...LEGO_3064_Broker_Virage/Surveys/Virage_Survey.xml 31 data SurveyResponse; 32 set in.Virage_Survey ; ERROR: The XML element name <QID2_TEXT_8cb70e63_1kek94049fwnActionability> is too long for a SAS variable name. ERROR: Encountered during XMLMap parsing at or near line 77, column 49. ERROR: XML describe error: Internal processing error. 33 run;
First just try using XMLV2 engine instead of the older XML engine. Perhaps it is smarter about dealing with long field names in the XML.
If that doesn't fix the issue then Read the documentation.
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/engxml/n1p6kbmn43fz0en1tajxf3y7karg.htm
There is even a tool that SAS had for crafting XMLMAP files. Never worked that well for me. I found it was just easier to take the autogenerated map and clean it up manually.
Is the XML file always using the same schema?
If so then write your own MAP file to tell the XML engine how to translate the XML into SAS datasets.
Hello,
I am not sure I understand. Suppose that the xlm file has always the same schema, how do we write a map file
Please provide an example.
First just try using XMLV2 engine instead of the older XML engine. Perhaps it is smarter about dealing with long field names in the XML.
If that doesn't fix the issue then Read the documentation.
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/engxml/n1p6kbmn43fz0en1tajxf3y7karg.htm
There is even a tool that SAS had for crafting XMLMAP files. Never worked that well for me. I found it was just easier to take the autogenerated map and clean it up manually.
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.