BookmarkSubscribeRSS Feed
confooseddesi89
Quartz | Level 8

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
PaigeMiller
Diamond | Level 26

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
confooseddesi89
Quartz | Level 8

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:

confooseddesi89_0-1632763110294.png

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:

confooseddesi89_1-1632763206877.png

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

Thanks.

PaigeMiller
Diamond | Level 26

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
confooseddesi89
Quartz | Level 8
It's pretty clear that idnum is ID. You can understand what I'm asking with the information provided. Thanks for your lack of help.
PaigeMiller
Diamond | Level 26

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
Reeza
Super User

@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:

 

confooseddesi89_1-1632763206877.png

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

Thanks.


 

confooseddesi89
Quartz | Level 8

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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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
  • 7 replies
  • 474 views
  • 1 like
  • 3 in conversation