Date: Tue, 24 May 2011 11:45:59 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Help Creating a Table - Take 2
In-Reply-To: <81F8139F381BE844AE05CA6525FF2AAE034910ED@tpwd-mx9.tpwd.state.tx.us>
Content-Type: text/plain; charset=ISO-8859-1
You can do that pretty easily in PROC TABULATE if you don't mind having
multiple variables there (ie, not just VAR_1 with '1 3 0' but three
columns).
-Joe
On Tue, May 24, 2011 at 11:42 AM, Warren Schlechte <
Warren.Schlechte@tpwd.state.tx.us> wrote:
> Hopefully, the formatting of this message will make it easier to read.
> ------------------------------------------------------------------------
> ---------------------------------
>
> I think this should be simple and not require me to create a new
> dataset, but I cannot see how to do this unless I first create a dataset
> that gives me the sums for each variable and value.
>
> What I have is a dataset that looks like:
>
> Var_1 Var_2 Var_3 Ind_Var
> A C B 0
> B A B 0
> A C A 1
> B B A 0
> C A C 1
> A B C 1
> B C C 0
>
> What I want is a table where the cell entries are the sum of the
> "cross-products" of the indicator variable and the variable values,
> like:
>
> Var_1 Var_2
> Var_3
> A B C A B C A B
> C
> Ind_Var
> 1 2 0 1 1 1 1 1
> 0 2
> 0 1 3 0 1 1 2 1
> 2 1
>
>
> Hopefully, this is a simple procedure call, just one I don't use very
> often.
>
> If it requires programming, I'm interested in seeing how others would do
> this, but don't feel compelled to respond as I can get something
> together.
>
> Thanks,
>
> Warren Schlechte
>
|