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.
@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 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;
SAS Output
1393 | 100.00 | 1393 | 100.00 |
1393 | 100.00 | 1393 | 100.00 |
1393 | 100.00 | 1393 | 100.00 |
3 | grp1 grp2 grp3 |
1393 |
1350 |
Weight: weight_num |
2 | 536.8515 | 268.4258 | 1.11 | 0.3287 |
1347 | 324685.3574 | 241.0433 | ||
1349 | 325222.2089 |
0.001651 | -17716.39 | 15.52557 | -0.087634 |
2 | 536.8515293 | 268.4257646 | 1.11 | 0.3287 |
2 | 536.8515293 | 268.4257646 | 1.11 | 0.3287 |
-0.08937308 | 13.9091106 |
-0.05322111 | 22.1748667 |
-0.11481910 | 15.9299903 |
Output from the PROC FREQ?
@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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.