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 (January 1997, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 29 Jan 1997 18:48:21 GMT
Reply-To:   Jay Weedon <j_weedon@ESCAPE.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Jay Weedon <j_weedon@ESCAPE.COM>
Organization:   None
Subject:   Re: one-way chi square
Content-Type:   text/plain; charset=us-ascii

On Tue, 28 Jan 1997 10:31:30 -0600, Jamil Ibrahim <ibrahim@FIONA.UMSMED.EDU> wrote:

>Does sas perform one way chi square? which proc >Dr. Jamil M. Ibrahim, Ph.D. >Institutional Research Associate, LRC >Assistant Professor, SHRP >The University of Mississppi Medical Center >2500 North State Street >Jackson, Mississippi 39216-4505 USA >Telephone: 1-(601) 984-1197 Fax:1-(601) 984-1205 >INternet: ibrahim@fiona.umsmed.edu

Don't know of any existing routines, but here's a method:

* Assume X is the variable to be tested; * First generate observed frequencies using proc freq; proc freq noprint data=whatever; tables x /out=freqs;

* Get total number of observations; data total; set freqs end=last; total+count; if last; keep total;

* Compute expected frequencies, chi-square & p-value; * The values 0.38, 0.22 etc. below refer to expected proportions of X belonging to category 1, 2 etc. according to some theoretical model I'm testing - plug in your own values (they should sum to 1). In this example there are seven relevant categories; data _null_; set freqs (rename=(count=observed)) end=last; if _n_=1 then set total; select (x); when (1) expected=total*0.38; when (2) expected=total*0.22; when (3) expected=total*0.03; when (4) expected=total*0.03; when (5) expected=total*0.15; when (6) expected=total*0.06; when (7) expected=total*0.13; end; chisq+((observed-expected)**2)/expected; if last then do; df=_n_-1; p=1-probchi(chisq,df); put 'Chi-square = ' chisq df= p= 10.4; end;


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