Date: Sun, 9 Dec 2007 22:58:45 -0800
Reply-To: Tree Frog <tree.frog2@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tree Frog <tree.frog2@HOTMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Proc Tabulate
Content-Type: text/plain; charset=ISO-8859-1
Hi Ram
I'm keen to learn (from other posters to this thread) how this might
be done using proc tabulate or similar. In the meantime, proc sql
offers this:
data new;
infile datalines dsd;
input result $ system $;
datalines;
normal,cardio
normal,cardio
normal,cardio
normal,cardio
normal,gastro
normal,gastro
normal,neuro
normal,neuro
normal,neuro
normal,neuro
normal,skin
normal,skin
normal,skin
abnormal,cardio
abnormal,gastro
abnormal,gastro
abnormal,gastro
abnormal,neuro
abnormal,resp
abnormal,resp
abnormal,resp
abnormal,resp
abnormal,resp
abnormal,skin
abnormal,skin
;
run;
proc sql;
select system
,count(case when result='abnormal' then 1 else . end) as n
,(count(case when result='abnormal' then 1 else . end)/
count(*)) as '%'n format=percent8.2
from new
group by system
order by system
;
quit;
Tree Frog
On Dec 10, 4:44 pm, RAMS <ramsath...@gmail.com> wrote:
> Dear All,
>
> I used proc tabulate for systemic examination cross
> tabulated for its result. The result will be either normal or
> abnormal. We are focusing only on abnormal.
>
> I wrote a code like
>
> proc tabulate data = new;
> class system result;
> table system,result*(n rowpctn);
> run;
>
> the above program producing the following report
> abnormal normal
> n % n %
> cardio 1 20 4 80
> gastro 3 60 2 40
> neuro 1 20 4 80
> resp 5 100 . .
> skin 2 40 3 60
>
> I dont want this normal column for display. When i give where result
> = 'abnormal' the percentages are wrong. How can i do that. Please
> help me out.
>
> Thanks & Regards,
>
> Ramsathish S
|