BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

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.

 

alepage
Barite | Level 11

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.

Tom
Super User Tom
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1185 views
  • 0 likes
  • 2 in conversation