BookmarkSubscribeRSS Feed
Calcite | Level 5

Dear Community,


I have read various post about when to use chi-squared test and when to use logistic regression and I have come to the conclusion, that it depends on who you ask.


However, I thought I would get the same result independent of what method I decided to use to examine the association between two variables. Now, - that is not the case in my situation.


I used the codes to examine the association between the preditive variable community and the criteria variabe MDD (event 1).


proc surveylogistic data=dietdivdummy;  (This shows no sig. diff.)
model mdd (event="1")=community;
weight sampwt;

proc freq data=dietdivdummy;   (This shows a sig. diff. between the two communities)
tables mdd*community / chisq;
exact pchi or;
weight sampwt;


I am still very new in this game so hope someone can explain to me what I am doing wrong.

I want to model the determinants of and predict the likelihood of an outcome and therefore will go with the proc surveylogistic methode. But can I trust the outcome?




Super User

Logistic regression assumes a function of the mean of the response variable is assumed to be linearly related to the explanatory variables.

Since you are not showing any complex sample design elements in the surveylogistic code why are you using surveylogistic?


Chi-square tests are for homogeneity or independence or measures of association. So your test is asking "are the variables associated", not "how does a change is one variable relate to a change in the other".


Also weight has somewhat different meaning between the two procedures.

Proc freq: If you use a WEIGHT statement, PROC FREQ assumes that an observation represents n observations, which will effectively change the sample size used for calculations.


Surveylogistic weight variable contains sampling weights, which are not the same.









Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation