|Date: ||Fri, 8 Jun 2007 08:16:55 -0700|
|Reply-To: ||dave crimkey <d_crimkey@YAHOO.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||dave crimkey <d_crimkey@YAHOO.COM>|
|Subject: ||Re: crosstabs|
|Content-Type: ||text/plain; charset=iso-8859-1|
Ok, sorry, maybe this will work better.
category description COUNT PERCENT
TOTAL 5 100.00%
ATEST 3 60.00%
xxxx 3 60.00%
yyyy 1 20.00%
BTEST 1 20.00%
zzzz 1 20.00%
CTEST 1 20.00%
bbbb 1 20.00%
cccc 1 20.00%
I've thought about proc tabulate but I don't know if it will take care of counting only IDs for the summary, but multiple descriptions for the detail
toby dunn <tobydunn@HOTMAIL.COM> wrote:
The output you sent was all garbled up but from what I can groak out of it,
it would seem you may want to investigate Proc Tabulate.
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: dave crimkey
Reply-To: dave crimkey
Subject: Re: crosstabs
Date: Fri, 8 Jun 2007 07:53:09 -0700
Sure, here's the output after I calculate the percentages in Excel
category description COUNT PERCENT TOTAL
5 100.00% ATEST 3 60.00% xxxx 3 60.00% yyyy
1 20.00% BTEST 1 20.00% zzzz 1 20.00%
CTEST 1 20.00% bbbb 1 20.00% cccc 1 20.00%
Jack Clark wrote:
Will you provide a sample of what the output should look like - with
Center for Health Program Development and Management
University of Maryland, Baltimore County
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Friday, June 08, 2007 9:54 AM
I've adjusted the code that was sent to me for the crosstabs and it
works really well! Thanks. Of course I'm trying to do something more
with it and I'm not a knowledgeable Proc Sql person.
Here's my code:
input id code category $ description $ ;
1 10 ATEST xxxx
1 12 ATEST yyyy
2 10 ATEST xxxx
3 15 BTEST zzzz
4 22 CTEST bbbb
4 23 CTEST cccc
5 10 ATEST xxxx
proc freq data=two noprint;
tables category*description/ out=twofreq;
create table need (drop=ordval) as
(select category, description, count as count, percent, '2' as ordval
(select category, ' ' as description, count(distinct id) as count,. as
percent,'1' as ordval
group by category)
(select ' TOTAL' as category, ' ' as description, count(distinct id)
as count, . as percent,'0' as ordval
order by category, ordval, description
proc print data=need;
This gives me an additional TOTAL number of id's without counting
duplicates. I'd like my percentages calculated off of that total and
I've tried numerous things in the sql proc but can't seem to get it.
I've been just pulling the output into Excel and calculcating the
percentages there but I'd like to be able to do it all in SAS. Is it
possible to do it all in the proc sql, or do I have to take the dataset
and do further manipulations outside of sql?
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight
and hotel bargains.
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
Get a preview of Live Earth, the hottest event this summer - only on MSN
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.