Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- proc logistic multivariate model--finding n for each variable

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 09-24-2015 03:35 PM
(824 views)

I'm doing a proc logistic and trying to figure out how to determine the frequencies of each variable used in my final model. The output tells me the number of observations read, but is there a way to know how the 'n' of each variable in my multivariate model?

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If I am understanding this question correctly, you want to know how many observations are used for each variable of your model. I believe the answer is the same for all variables and will be the one that you already have. If a given value is missing for a single variable, then even if there is data for the other variables, the entire observation will be dropped from the model calculations. So any observation with missing values for variables included in your model will be dropped. You should look into handling missing data so that you can fill these missing values before hand with imputed values.

Best of luck,

Daniel

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hmm I included the code below and specified that observations are dropped for the variables in the model. However, I've seen tables in many publications where the 'n' is listed for variables in unadjusted and adjusted models. And the variables in the adjusted models have different 'n' values.

**proc** **logistic** descending data=meley.burum7; /*MODEL 1*/

model exclusive= mbmi /*keep*/

childage /*keep*/

primi /*keep*/

/*married not_married_partner*/

/*dailyincome2*/

Q38_Borrowed_money_from_others

/*Read_or_Write*/

Lib_lessthan8 Lib_morethan8 Gha_zone1112 /*ACC: Time living in Ghana with 4 groups*/

mom_age;

where exclusive ne **.** and mbmi ne **.** and childage ne **.** and primi ne **.** and marital_status_model2 ne **.** and dailyincome2 ne **.**

and Read_or_Write ne **.** and Q38_Borrowed_money_from_others ne **.** and acc25_timeinghana ne **.** and mom_age ne **.** ; **run**;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

That would mean that your cohort isn't the same across your analysis which implies unfair model comparisons to me. I could be wrong of course...

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The problem is that if a record is missing observations, then comparing it to those that are not is like comparing apples and oranges. For example, if you are predicting exclusive and have trained your model and found that both childage and primi are very influential in predicting exclusive. Then if you have one observation that has records for both childage and primi and one record that is missing a value for primi, then it would be inconsistent to use the same model to predict both records. This has to do with the fact that when you are calculating model coefficients, you are finding the impact of any independent variable on the dependent variable while holding all other independent variables constant. If you don't have those other variables (due to missing values), then really what you have is a completely different model e.g. y=x_1+x_2 vs. y=x_1. So the 'n' or number of observations for your model should be the same for all variables used in your model. I am not sure what you have seen in other publications, perhaps they were running multiple experiments with different cohorts and then comparing them? By default, SAS will drop any observations with missing values that are used in the model for this reason. I hope that helps.

Best,

Daniel

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. **

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.