BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
grace999
Obsidian | Level 7

I was using Proc GLM. the model removed 35 records when running the model. I checked the data, and no missing in either Y nor Xs. How do I find out those removed records? Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@grace999 wrote:
proc glm data=new;
class cat_3lvl;
model pct_num=cat_3lvl;
weight weight_num;
means cat_3lvl;
run;

Log:

NOTE: PROCEDURE GLM used (Total process time):
real time 0.04 seconds
cpu time 0.05 seconds

I suspect the issue may be your weight variable. From documentation for Proc GLM:

An observation is used in the analysis only if the value of the WEIGHT statement variable is nonmissing and greater than zero.

So if weight_num is missing, 0 or negative the record is excluded.

 

View solution in original post

7 REPLIES 7
Reeza
Super User

@grace999 wrote:

I was using Proc GLM. the model removed 35 records when running the model. I checked the data, and no missing in either Y nor Xs. How do I find out those removed records? Thanks. 


There has to be missing. 

 

You need to check all variables in your CLASS, BY and/or MODEL statements. Replace the data set name with your data set and run it. If you still don't see the missing values please post your PROC GLM code, the log and the output from the code below as well.

 

proc format ;
	value $ missfmt ' '="Missing" other="Not Missing";
	value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods table onewayfreqs=temp;

proc freq data=YOUR_DATA_SET_NAME;
	table _all_ / missing;
	format _numeric_ nmissfmt. _character_ $missfmt.;
run;

 

grace999
Obsidian | Level 7

SAS Output

The FREQ Procedure
pct_num Frequency Percent CumulativeFrequency CumulativePercentNot Missing
1393100.001393100.00

 

cat_3lvl Frequency Percent CumulativeFrequency CumulativePercentNot Missing
1393100.001393100.00

 

weight_num Frequency Percent CumulativeFrequency CumulativePercentNot Missing
1393100.001393100.00

 


The GLM Procedure
Class Level InformationClass Levels Valuescat_3lvl
3grp1 grp2 grp3

 

Number of Observations ReadNumber of Observations Used
1393
1350

 

 


 

The GLM Procedure
 
Dependent Variable: pct_num

 

Weight: weight_num
Source DF Sum of Squares Mean Square F Value Pr > FModelErrorCorrected Total
2536.8515268.42581.110.3287
1347324685.3574241.0433  
1349325222.2089   

 

R-Square Coeff Var Root MSE pct_num Mean
0.001651-17716.3915.52557-0.087634

 

Source DF Type I SS Mean Square F Value Pr > Fcat_3lvl
2536.8515293268.42576461.110.3287

 

Source DF Type III SS Mean Square F Value Pr > Fcat_3lvl
2536.8515293268.42576461.110.3287

 

 


 

The GLM Procedure
Level ofcat_3lvl N Sum ofWeights pct_numMean Std Devgrp1 664 367834grp2 97 260940grp3 589 306783
-0.0893730813.9091106
-0.0532211122.1748667
-0.1148191015.9299903
grace999
Obsidian | Level 7
proc glm data=new;
class cat_3lvl;
model pct_num=cat_3lvl;
weight weight_num;
means cat_3lvl;
run;

Log:

NOTE: PROCEDURE GLM used (Total process time):
real time 0.04 seconds
cpu time 0.05 seconds
Reeza
Super User

Output from the PROC FREQ?

ballardw
Super User

@grace999 wrote:
proc glm data=new;
class cat_3lvl;
model pct_num=cat_3lvl;
weight weight_num;
means cat_3lvl;
run;

Log:

NOTE: PROCEDURE GLM used (Total process time):
real time 0.04 seconds
cpu time 0.05 seconds

I suspect the issue may be your weight variable. From documentation for Proc GLM:

An observation is used in the analysis only if the value of the WEIGHT statement variable is nonmissing and greater than zero.

So if weight_num is missing, 0 or negative the record is excluded.

 

grace999
Obsidian | Level 7
Yes. The weight variable includes negative. What shall I do if the weight variable is the one I really need to use since negative is valid values?
PaigeMiller
Diamond | Level 26

I don't know how a negative value for a weight can be "valid". The procedure can't use a negative weight. Explain how it can be valid.

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1420 views
  • 2 likes
  • 4 in conversation