Date: Tue, 25 Jan 2005 13:43:27 -0500
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Re: Problem getting XML output from proc freq
On Tue, 25 Jan 2005 11:29:18 -0500, Joe Polanik <jPolanik@CDS.DUKE.EDU> wrote:
>I'm having trouble with ODS. I'd like to get output in XML. The XML file
> is created, but contains HTML not XML. The data in the file (variable
>name, value, frequency of value and cumulative frequency) is correct.
>It's just the markup language that's not.
Hi, Joseph,
I am getting an xml document with no problem with sas 9.1.2 on win XP. If
you want to export your out= data, try xml library engine. HTH.
Cheers,
Chang
ods xml body="class.xml";
proc freq data=sashelp.class;
tables sex age/nopercent nocol norow;
run;
ods xml close;
/* class.xml file goes like:
<?xml version="1.0" encoding="windows-1252" ?>
<odsxml>
<head>
<meta operator="*****" />
</head>
<body>
<proc name="Freq">
<label name="IDX" />
<title class="SystemTitle" toc-level="1">The SAS System</title>
<proc-title class="ProcTitle" toc-level="1">
...
*/
proc freq data=sashelp.class;
tables sex/nopercent nocol norow out=f_sex;
tables age/nopercent nocol norow out=f_age;
run;
libname class2 xml "class2.xml";
data class2.f_sex;
set f_sex;
run;
data class2.f_age;
set f_age;
run;
libname class2 clear;
/* class2.xml file goes like:
<?xml version="1.0" encoding="windows-1252" ?>
<TABLE>
<F_AGE>
<Age>11</Age>
<COUNT>2</COUNT>
<PERCENT>10.5263158</PERCENT>
</F_AGE>
<F_AGE>
<Age>12</Age>
<COUNT>5</COUNT>
<PERCENT>26.3157895</PERCENT>
</F_AGE>
<F_AGE>
<Age>13</Age>
...
*/