BookmarkSubscribeRSS Feed
tanya13
Calcite | Level 5

HI I AM RUNNING THE FOLLOWING CODE IN ORDER TO COMPUTE THE VALUE OF THE DFBETAS FOR EACH STATE, BUT I AM GETTING MANY WARNINGS AND  ERRORS 

 

proc reg data=newsalaries;
model teach_sal = edu_spen geograph area2 area3/ influence vif;
output out=new1 h=hatdiags p=pred r=resid
student=stres cookd= cooksD dffits= dffits ;
title1 'DFBETAS for each state';
symbol1 value=dot pointlabel = (height = 10pt
'#state');
run;
plot stres*pred;
plot hatdiags*pred;
plot cooksD*pred;
run;

 

 

THESE ARE THE WARNINGS AND ERRORS I AM GETTING AND I HAVE TRIED REPLACING THE "PRED" WITH "GEOGRAPH" BUT THEN I GET ANOTHER ERROR. I AM USING SAS VERSION 9.4. I WOULD REALLY APPRECIATE SOME HELP WITH THIS. THANK YOU.

551 proc reg data=newsalaries;
552 model teach_sal = edu_spen geograph area2 area3/ influence vif;
ERROR: Variable geograph in list does not match type prescribed for this list.
NOTE: The previous statement has been deleted.
553 output out=new1 h=hatdiags p=pred r=resid
554 student=stres cookd= cooksD dffits= dffits ;
555 title1 'DFBETAS for each state';
556 symbol1 value=dot pointlabel = (height = 10pt
557 '#state');
558 run;

WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds

NOTE: The data set WORK.NEW1 has 0 observations and 0 variables.
WARNING: Data set WORK.NEW1 was not replaced because new file is incomplete.

559 plot stres*pred;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

560 plot hatdiags*pred;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

561 plot cooksD*pred;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

562 run;

2 REPLIES 2
Reeza
Super User

Fix the errors in the order they appear. When you fix the first ones the latter ones will likely go away too. 

 

So your first error:

 

ERROR: Variable geograph in list does not match type prescribed for this list.

 

So GeoGraph is likely a character variable when it should be numeric to be included in a regression model for obvious reasons. 

Convert the variable to a numeric variable and it will work. 

 

Your PLOT statements later on don't make sense though, they aren't in a PROC. Wherever you're referencing is also very outdated, PLOT statements within PROC REG have been disabled for a while and PROC GPLOT is outdated as well. If you want to create a graph try SGPLOT procedures instead. Make sure to reference the correct documentation for your version of SAS/STAT which you can check using:

 

proc product_status;run;

The latest version is SAS/STAT 14.3

 


@tanya13 wrote:

HI I AM RUNNING THE FOLLOWING CODE IN ORDER TO COMPUTE THE VALUE OF THE DFBETAS FOR EACH STATE, BUT I AM GETTING MANY WARNINGS AND  ERRORS 

 

proc reg data=newsalaries;
model teach_sal = edu_spen geograph area2 area3/ influence vif;
output out=new1 h=hatdiags p=pred r=resid
student=stres cookd= cooksD dffits= dffits ;
title1 'DFBETAS for each state';
symbol1 value=dot pointlabel = (height = 10pt
'#state');
run;
plot stres*pred;
plot hatdiags*pred;
plot cooksD*pred;
run;

 

 

THESE ARE THE WARNINGS AND ERRORS I AM GETTING AND I HAVE TRIED REPLACING THE "PRED" WITH "GEOGRAPH" BUT THEN I GET ANOTHER ERROR. I AM USING SAS VERSION 9.4. I WOULD REALLY APPRECIATE SOME HELP WITH THIS. THANK YOU.

551 proc reg data=newsalaries;
552 model teach_sal = edu_spen geograph area2 area3/ influence vif;
ERROR: Variable geograph in list does not match type prescribed for this list.
NOTE: The previous statement has been deleted.
553 output out=new1 h=hatdiags p=pred r=resid
554 student=stres cookd= cooksD dffits= dffits ;
555 title1 'DFBETAS for each state';
556 symbol1 value=dot pointlabel = (height = 10pt
557 '#state');
558 run;

WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds

NOTE: The data set WORK.NEW1 has 0 observations and 0 variables.
WARNING: Data set WORK.NEW1 was not replaced because new file is incomplete.

559 plot stres*pred;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

560 plot hatdiags*pred;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

561 plot cooksD*pred;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

562 run;


 

PaigeMiller
Diamond | Level 26

Converting GEOGRAPH to numeric may not make sense, if the variable is not something that can be converted to numbers (like if it is a US state, then numbers don't make sense). In that case PROC GLM could be used to handle the model fit but it won't compute DFBETAS. Yes, I know, that's not fair.

 

You could create dummy variables and use PROC REG and computer DFBETAS. 

--
Paige Miller

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1367 views
  • 0 likes
  • 3 in conversation