BookmarkSubscribeRSS Feed
Prudhvi_007
Calcite | Level 5

I have a requirement to import 17,000 xml files from client into single SAS dataset . I have tried VB script for converting XML to Excel so that i could write a macro in sas to convert these Excel files to SAS datasets, but not working.  Please provide your valuable suggestions .

7 REPLIES 7
Prudhvi_007
Calcite | Level 5
Yes , file structure is identical for all the files.
Kurt_Bremser
Super User

Do a Google search for "SAS read xml data". You will get lots of results. Once you have code to read a single file, post it, so we can make suggestions for automation.

Prudhvi_007
Calcite | Level 5
Thank you for the sources . Its very helpful.
Ksharp
Super User

Firstly ,pick up one XML to test and find which dataset you need to keep .

 

filename x temp;
libname x xmlv2 'c:\temp\define.xml' xmlmap=x automap=replace ;
proc copy in=x out=work;
run;
Prudhvi_007
Calcite | Level 5

Hi . Thank you for the code . I tried your code on one xml file . It worked . One xml file is split into 8 datasets . It threw the below error .

Prudhvi_007_0-1652087860843.png

Can we convert one xml to one dataset instead of 7-8 sub datasets. Once it can be done , we can automate the code for 1000 xmls.

Ksharp
Super User
You need option CHARMULTIPLIER= to extend your variable length.

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/engxml/n0kvon2742e4c7n1qxt6truvio5y.htm

If you have XML Map file, that maybe could import one dataset.

Search the usage of XML engine or XMLV2 engine at support.sas.com

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/engxml/p0rkqlpx0jxrgun0zidmv4ecr4c9.htm
https://support.sas.com/en/search.html?q=xmlv2

You could find more example .

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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