LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 2011, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 24 May 2011 14:05:56 -0500
Reply-To:     Warren Schlechte <Warren.Schlechte@TPWD.STATE.TX.US>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Warren Schlechte <Warren.Schlechte@TPWD.STATE.TX.US>
Subject:      Re: Help Creating a Table - Take 2
Comments: To: Charlie Huang <charlie.chao.huang@gmail.com>
In-Reply-To:  <BANLkTimZAnUu_fCDJk=yM8BawAz1=J6Z8w@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Thanks for showing me how it could be done in Proc Report.

I had never used it before, so seeing an example was quite helpful.

Warren Schlechte

-----Original Message----- From: Charlie Huang [mailto:charlie.chao.huang@gmail.com] Sent: Tuesday, May 24, 2011 1:15 PM To: Warren Schlechte Cc: SAS-L@listserv.uga.edu Subject: Re: Help Creating a Table - Take 2

Hi Warren;

Proc Report may be better.

data have; input ( Var_1 Var_2 Var_3 ) ($) Ind_Var; cards; 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 ;;; run;

option missing = 0; proc report data = have nowd h; column Var_1 Var_2 Var_3 Ind_Var; define var_1 / across; define var_2 / across; define var_3 / across; define Ind_Var / group; run;

Best, Charlie

On Tue, May 24, 2011 at 12:53 PM, Warren Schlechte <Warren.Schlechte@tpwd.state.tx.us> wrote: > I thought Tabulate might get me what I wanted, but I still thought I had > to create a VARIABLE column that contained either "Var_1", "Var_2" or > "Var_3". > > > > With a little work, I was able to get the syntax correct to get me what > I want. > > > > Thanks, > > > > Warren Schlechte > > From: Joe Matise [mailto:snoopy369@gmail.com] > Sent: Tuesday, May 24, 2011 11:46 AM > To: Warren Schlechte > Cc: SAS-L@listserv.uga.edu > Subject: Re: Help Creating a Table - Take 2 > > > > 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 > > >


Back to: Top of message | Previous page | Main SAS-L page