SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

how to convert inline xml into SAS dataset?

Reply
Contributor
Posts: 23

how to convert inline xml into SAS dataset?

We have a requirement to convert an xml data into sas dataset. The values are stored within attributes of the elements. We can only parse the element values and convert into dataset. Is there any solution to convert attribute values into dataset columns?

Super User
Super User
Posts: 6,502

Re: how to convert inline xml into SAS dataset?

Sounds like you have XML stored in datasets (rather than in-line with the program).

If your data is actually in a database server like Oracle then using their built in tools to create a view would probably be the best.

Otherwise it is possible to write the data to text file and use SAS's XML engine to read it as a dataset.  Will probably take some time to figure out how to generate the proper map to read it.  Also SAS much prefers that the XML is nice a simple, but if it was that simple then you probably would have just stored it as variables to begin with.

filename xmlfile temp;

data _null_;

  set have;

  file xmlfile ;

  put xmlvar ;

run;

libname xmlfile xml ;

data want ;

  set xmlfile.table1 ;

run;

Occasional Contributor
Posts: 13

Re: how to convert inline xml into SAS dataset?

Use SAS XML Mapper tool.  This will create the SAS code and XML maps needed to read your XML into a SAS dataset.

Ask a Question
Discussion stats
  • 2 replies
  • 338 views
  • 0 likes
  • 3 in conversation