LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 4 May 2005 10:54:52 +0200
Reply-To:   "adel F." <adel_tangi@YAHOO.FR>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "adel F." <adel_tangi@YAHOO.FR>
Subject:   Re: QR: SAS version of crostabs procedure in SPSS
Comments:   To: cassell.david@EPAMAIL.EPA.GOV
In-Reply-To:   6667
Content-Type:   text/plain; charset=iso-8859-1

Thanks David, The below code gives the following table

x1

x2

y

Frequency

Cumulative Frequency

0

0

0

2159

2159

0

0

1

7841

10000

0

1

0

2687

12687

0

1

1

7313

20000

1

0

0

1743

21743

1

0

1

8257

30000

1

1

0

1549

31549

1

1

1

8451

40000

Whic is not what I am looking for, I am looking to have a pecentage by rows or culumns, and like a 3 way contingency tables, the crosstab in SPSS does this very good, but I would like to do the same in SAS, because I prefere to work with SAS

Cheers

Adel

"David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV> wrote: "adel F." wrote: > I would like to obtain a single frequency table from SAS, similar to > the one produced by SPSS, when I use the code below I obtain two sub > tables one for x2 by y Controlling for x1=0, and the other for x2 by > y Controlling for x1=1. > > How I can obtain one single table? > Thanks for any suggestions > > data test; > b0 = 1.3; > b1 = .3; > b2 = -.3; > b3 = .4; > do x1=0 to 1; > do x2=0 to 1; > eta = b0 + b1*x1 + b2*x2 + b3*x1*x2; > prob = exp(eta) / (1 + exp(eta)); > do i=1 to 10000; > y = ranbin(1234579,1,prob); > output; > end; > end; > end; > keep x1 x2 y; > run; > > ods listing close; > ods rtf file="testa3n"; > > proc freq data=test; > title1 'example'; > table x1*x2*y/ nopercent norow nofreq; > run;

It isn't clear exactly *which* table in *what* format you have in mind. But here you're asking SAS for a three-way table, so it gives it as three dimensions. If you want to get it in a single form, one thing you cna try would be to use the keyword LIST in the table statement, like this:

proc freq data=test; title1 'example'; table x1*x2*y/ nopercent norow nofreq LIST ; run;

That will change the format of the table and may give you what you're looking for. But it's hard for me to tell from way over here. :-)

By the way, it would be easier to read your code and help you out if you could indent the code. Thanks.

David -- David Cassell, CSC Cassell.David@epa.gov Senior computing specialist mathematical statistician

--------------------------------- Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail


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