Here's my source code:
* Create test SAS dataset ;
data work.kids;
input name $ age gender $;
datalines;
Kamina 6 F
Raelani 4 F
Elliott 1 M
;
run;
libname myxml xmlv2 "C:\temp\kids.xml";
* Write SAS data to XML ;
data myxml.kids;
set work.kids;
run;
* Read XML data into SAS;
data work.getback;
set myxml.kids;
run;
* Show what you got;
proc print data=work.getback;
run;
Here's the output from PROC PRINT:
Obs | name | age | gender |
---|---|---|---|
1 | Kamina | 6 | F |
2 | Raelani | 4 | F |
3 | Elliott | 1 | M |
Here's the XML that was written, and then read back in:
<?xml version="1.0" encoding="windows-1252" ?>
<TABLE>
<KIDS>
<name>Kamina</name>
<age>6</age>
<gender>F</gender>
</KIDS>
<KIDS>
<name>Raelani</name>
<age>4</age>
<gender>F</gender>
</KIDS>
<KIDS>
<name>Elliott</name>
<age>1</age>
<gender>M</gender>
</KIDS>
</TABLE>
No comments:
Post a Comment