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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- How to determine which subjects are excluded from PROC MIXED/GENMOD

- 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-23-2021 08:43 PM
(473 views)

Hi,

I am conducting analyses in Proc glimmix and Proc mixed that have random intercepts for subjects ("groups"), with the subject being labeled as ID. See my code below:

Proc glimmix:

```
Proc glimmix data=Data NOCLPRINT NOITPRINT METHOD= MSPL namelen=40;
CLASS id;
model caff(ref='0')=restdur_PMC restdur_PM / ODDSRATIO SOLUTION DIST=BINARY ddfm=bw;
RANDOM Intercept / TYPE=AR(1) Subject=id;run;
```

Proc mixed:

```
Proc mixed data=data NOCLPRINT NOITPRINT COVTEST METHOD=ML namelen=40;
CLASS id;
model rest_dur_hr = caff_binary_lag_PMC caff_binary_lag_persmean / SOLUTION CL ddfm=bw;
RANDOM Intercept / TYPE=AR(1) Subject=id;run;
```

I have several subjects (that is, ID's) that are excluded from the analyses due to missing data. I would like to be able to produce output that shows exactly which ID's are excluded from each analysis in my dataset. Describing which cases have been excluded is needed for manuscripts. Thank you for any help you can give me.

Best,

confooseddesi89

7 REPLIES 7

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

Just search for missings among your X and Y variables.

OR

Use the PROC to create an output data set that contains residual values. Any observation with missing values where the residual values should be was excluded from the analysis.

--

Paige Miller

Paige Miller

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

Hi,

The PROC GLIMMIX and MIXED procedures I used have a "where" clause that excludes IDs for which there are < 3 values for a variable called "caffeinated_beverages." I used the PROC in each analysis to output a dataset. I discovered there were some ID numbers that were excluded from the analyses that, according to PROC FREQ, had ≥3 values for "caffeinated_beverages", and I thought should not have been excluded. I looked closer and I realized that PROC FREQ was giving me incorrect numbers for the number of non-missing data values for "caffeinated_beverages", for select ID numbers. See below for the variable "caffeinated_beverages", id number "3" has only 2 values present, and one missing:

I use PROC FREQ to show me the number of non-missing values per ID number, see below code:

`proc freq data=data; where caffeinated_beverages~=.;table id;run;`

But this is what I get for ID number 3 using PROC FREQ:

Is there a reason PROC FREQ could be giving me wrong numbers, assigning the missing value as present?

Thanks.

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

The data you show does not have a variable named ID. There are other discrepancies here.

It is not possible to know what your screen captures from Excel really mean when converted into an actual SAS data set.

Provide a portion of the actual SAS data set you are using as SAS data step code (instructions). Do not attach files. Do not provide screen captures. Follow the instructions.

--

Paige Miller

Paige Miller

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

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

No, I can't understand the problem from the information provided. Converting Excel to SAS sometimes produces unexpected results. So in order to know what is causing SAS to do what it is doing, I need to see the SAS data set, not screen captures from Excel.

--

Paige Miller

Paige Miller

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

@confooseddesi89 wrote:

Is there a reason PROC FREQ could be giving me wrong numbers, assigning the missing value as present?

Thanks.

Possible reasons - your data import was wrong.

If the 3 is in the middle of the column as the screenshot shows that actually indicates that the values is NOT numeric. Numeric values are aligned by default in output from SAS.

@confooseddesi89 wrote:

Is there a reason PROC FREQ could be giving me wrong numbers, assigning the missing value as present?

Thanks.

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

Hi Reeza! Thanks for helping me out. The variable is numeric.

I reran the numbers and the freqs are correct now. I'm not sure what the original error was - why I got the wrong freqs - but at least it's correct now. Thanks again.

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.