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.

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
  • 589 views
  • 0 likes
  • 2 in conversation