| Return to previous page
|
This example generates an output XML document on the source host, then translates the XML markup on the target host. The XML engine uses all defaults; for example, the format is GENERIC, which is simple, well-formed XML markup.
The following output shows the SAS data set MYFILES.CLASS to be moved from one host to another:
The SAS System 1
Obs Name Sex Age Height Weight
1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
7 Jane F 12 59.8 84.5
8 Janet F 15 62.5 112.5
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
11 Joyce F 11 51.3 50.5
12 Judy F 14 64.3 90.0
13 Louise F 12 56.3 77.0
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0
The following SAS program generates an output XML document on the source host for the SAS data set MYFILES.CLASS:
libname myfiles 'SAS-library'; [1] libname trans xml 'external-file'; [2] proc copy in=myfiles out=trans; [3] select class; run;
The resulting XML document is as follows:
<?xml version="1.0" ?>
<TABLE>
<CLASS>
<Name> Alfred </Name>
<Sex> M </Sex>
<Age> 14 </Age>
<Height> 69 </Height>
<Weight> 112.5 </Weight>
</CLASS>
<CLASS>
<Name> Alice </Name>
<Sex> F </Sex>
<Age> 13 </Age>
<Height> 56.5 </Height>
<Weight> 84 </Weight>
</CLASS>
.
.
.
<CLASS>
<Name> William </Name>
<Sex> M </Sex>
<Age> 15 </Age>
<Height> 66.5 </Height>
<Weight> 112 </Weight>
</CLASS>
</TABLE>
After the XML document is generated on the source host, it must be transferred from the source host to the target host. For example, you can use FTP (File Transfer Protocol) to transfer the file.
With the XML document available on the target host, the following SAS program translates the XML markup to SAS proprietary format:
libname trans xml 'external-file'; [1] libname myfiles 'SAS-library'; [2] data myfiles.class; [3] set trans.class; run;
proc freq data=myfiles.class; run;
The SAS System 1
The FREQ Procedure
WEIGHT
Cumulative Cumulative
WEIGHT Frequency Percent Frequency Percent
-----------------------------------------------------------
50.5 1 5.26 1 5.26
77.0 1 5.26 2 10.53
83.0 1 5.26 3 15.79
84.0 2 10.53 5 26.32
84.5 1 5.26 6 31.58
85.0 1 5.26 7 36.84
90.0 1 5.26 8 42.11
98.0 1 5.26 9 47.37
99.5 1 5.26 10 52.63
102.5 2 10.53 12 63.16
112.0 2 10.53 14 73.68
112.5 2 10.53 16 84.21
128.0 1 5.26 17 89.47
133.0 1 5.26 18 94.74
150.0 1 5.26 19 100.00
.
.
.