Date: Mon, 3 Oct 2005 13:21:34 -0700
Reply-To: toby989@HOTPOP.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby989@HOTPOP.COM
Subject: Add: Outputting Ns of cells into different Vars TAB FREQ MEANS
In-Reply-To: <dhs30n$9f1$1@news.Stanford.EDU>
Content-Type: text/plain; charset=windows-1252; format=flowed
toby989@hotpop.com wrote:
> Hi All
>
> I want to create a summary of two variables, one with 100 levels, the
> other one with 3 levels, into a table that shows the Ns by cell. FREQ,
> TABULATE or MEANS procedure create one row for each level combination
> (100x3=300rows) and put the numbers into one variable, but for further
> processing, i need a dataset with 100 rows and 3 variables.
>
> I would be so grateful for your help on this.
>
> Thanks Toby
>
In the way that proc freq outputs data in the first place!!! I dont know
why dataset is not created the same way the output is set up???
proc freq data=h;
tables hospid*workgrp /all nopercent norow nocol out=outpct;
run;
The SAS System 09:45 Monday, October 3, 2005 14
The FREQ Procedure
Table of hospid by workgrp
hospid(hospid) workgrp(workgrp)
Frequency 1 2 3 Total
9 98 114 76 288
31 6 126 14 146
32 518 495 89 1102
33 118 97 63 278
34 46 65 71 182
35 114 103 36 253
38 45 42 14 101
39 251 251 76 578
>
> 1 1
> 1 1
> 1 2
> 1 2
> 1 3
> 1 3
> 1 3
> 2 1
> 2 2
> 2 2
> 2 3
> 3 1
> 3 1
> .
> .
> .
> 99
>
> into
>
> 1 2 2 3
> 2 1 2 1
> 3 2 ...
> .
> .
> 99