Date: Fri, 19 Jan 2007 15:13:08 -0500
Reply-To: Jake Bee <johbee@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jake Bee <johbee@GMAIL.COM>
Subject: Re: Is there an ODS way to get 4 (proc freq) 2x2 tables on one
page with the p-value?
In-Reply-To: <148E8334465C024399DD7B14E61D7D15186DB2B3@m-nchstp-2.nchstp.cdc.gov>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
The procedure works, for creating an rtf, but with the trace I still don't
see the datasets.
I could use one table per page, but the trick is to get the xp2_fish out of
the chisq fisher
to place only the p-value on the page below the cross table. Does anyone
have any ideas
on how to only get xp2_fish and like it the the 2x2 table?
Thanks, this first portion for the rtf is great!
Jake
On 1/19/07, Gerstle, John (CDC/CCID/NCHHSTP) (CTR) <yzg9@cdc.gov> wrote:
>
> Jake,
> Yes, there are several ways to get your output out via ODS. But you may
> have some trial/error to get what looks the best.
>
> The easiest way to get the freq output, using your code below is this:
>
> Ods rtf file="c:\temp\test file.rtf" style=minimal;
> >>proc freq data=ae order=data;
> >> by cat ae;
> >> weight count;
> >> tables hadae*dose / chisq fisher norow nocol nocum nopercent
> >> /*out=f_2(drop=percent)*/;
> >> format hadae ynfmt. ae $preffmt. dose $dosefmt. cat catfmt.;
> >> /*output out=f_tx(keep=cat ae n xp2_fish) CHISQ FISHER;*/
> >>run;
> Ods rtf close;
>
> Note that I commented out you two output statements. The output of FREQ
> will be sent to the destination file (here the RTF file called 'test
> file.rtf'), as well as the listing (output window). But this is probably
> not what you would like.
>
> I would suggest first use ODS TRACE ON/OFF to find the names of the
> tables, then use ODS OUTPUT first to get the output sent to a pair of
> datasets, manipulate said datasets until you have a dataset useful
> enough to report out using PROC PRINT, REPORT, or TABULATE, using ODS
> RTF/HTML/etc. to send the final report to a happy destination.
>
> For example (untested code) (I don't know what the Chi Square/Fisher's
> table might be called offhand):
>
> Ods output crosstabfreqs=f_2 (drop=percent)
> Chisq = f_tx (keep=cat ae n xp2_fish);
> *ods trace on;
> >>proc freq data=ae order=data;
> >> by cat ae;
> >> weight count;
> >> tables hadae*dose / chisq fisher norow nocol nocum nopercent;
> >> format hadae ynfmt. ae $preffmt. dose $dosefmt. cat catfmt.;
> >>run;
> *ods trace off;
> Ods output close;
>
> <some data steps etc here to get your two datasets together>
>
> Ods rtf file="c:\temp\test file.rtf" style=minimal;
> >>proc print data=final;
> run;
> Ods rtf close;
>
> OR
>
> Ods rtf file="c:\temp\test file.rtf" style=minimal;
> >>proc print data=f_2;
> run;
> >>proc print data=f_tx;
> run;
> Ods rtf close;
>
>
> John Gerstle, MS
> Biostatistician
> Northrop Grumman
> CDC Information Technological Support Contract (CITS)
> NCHSTP \DHAP \HICSB \Research, Analysis, and Evaluation Section
> Centers for Disease Control and Prevention
>
> "Boss. We've got cats." "Meow"
>
> "All truth passes through three stages:
> First, it is ridiculed;
> Second, it is violently opposed;
> Third, it is accepted as being self-evident."
> - Arthur Schopenhauer (1830)
>
>
> >>-----Original Message-----
> >>From: owner-sas-l@listserv.uga.edu
> [mailto:owner-sas-l@listserv.uga.edu]
> >>On Behalf Of Jake Bee
> >>Sent: Friday, January 19, 2007 12:49 PM
> >>To: sas-l
> >>Subject: Is there an ODS way to get 4 (proc freq) 2x2 tables on one
> page
> >>with the p-value?
> >>
> >>Example Code:
> >>
> >>For this I would like to get the tables for each AE, and the 4
> treatment
> >>group freqs on one page
> >>containing the 2x2 table and the p-value. I'm not sure if this can be
> >>done
> >>with ODS and proc freq,
> >>or if I have to take the freq output and pipe it through tabulate,
> then
> >>try
> >>to use the ODS. The trick
> >>will also be to the the p-value under each 2x2 table. I found SAS
> help
> >>where this can be done with
> >>graphs, but nothing so far for freq output;
> >>
> >>Thanks for any help, links, directory, thumbs down, etc.
> >>
> >>dm 'out' clear;
> >>dm 'log' clear;
> >>
> >>options byline nodate ls=132 ps=52;
> >>
> >>proc format;
> >> value $preffmt
> >> 'A'='Abdominal pain'
> >> 'B'='Headache'
> >> 'C'='Decrease appetite'
> >> 'D'='Nausea';
> >>
> >> value $dosefmt
> >> 'P'='Placebo'
> >> 'B'='10mg'
> >> 'C'='20mg'
> >> 'D'='30mg'
> >> 'T'='Total';
> >>
> >> value catfmt
> >> 1='10mg vs Placebo'
> >> 2='20mg vs Placebo'
> >> 3='30mg vs Placebo'
> >> 4='Active vs Placebo';
> >>
> >> value ynfmt
> >> 1='Yes'
> >> 2='No';
> >> run;
> >>quit;
> >>
> >>data ae;
> >>input ae $ hadae count dose $ cat;
> >>datalines;
> >>B 1 51 B 1
> >>B 1 34 P 1
> >>B 2 20 B 1
> >>B 2 38 P 1
> >>B 1 10 C 2
> >>B 1 4 P 2
> >>B 2 61 C 2
> >>B 2 68 P 2
> >>B 1 2 D 3
> >>B 1 4 P 3
> >>B 2 69 D 3
> >>B 2 68 P 3
> >>B 1 26 T 4
> >>B 1 3 P 4
> >>B 2 45 T 4
> >>B 2 69 P 4
> >>;
> >>run;
> >>
> >>proc sort data=ae;
> >> by cat ae hadae;
> >>run;
> >>
> >>proc freq data=ae order=data;
> >> by cat ae;
> >> weight count;
> >> tables hadae*dose / chisq fisher norow nocol nocum nopercent
> >> out=f_2(drop=percent);
> >> format hadae ynfmt. ae $preffmt. dose $dosefmt. cat catfmt.;
> >> output out=f_tx(keep=cat ae n xp2_fish) CHISQ FISHER;
> >>run;
>
>
|