BookmarkSubscribeRSS Feed
bioresearch
Calcite | Level 5

I am trying to run a regeression program on sashelp.car using KEEP statement and here is the code that I used;

 

data auto;
set sashelp.cars;
keep make model MSRP;
run;
proc reg data=auto;
model MSRP=make model;
run;

and the log is;

 

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc reg data=auto;
74 model MSRP=make model;
ERROR: Variable Make in list does not match type prescribed for this list.
ERROR: Variable Model in list does not match type prescribed for this list.
NOTE: The previous statement has been deleted.
75 run;
 
WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
76
77
78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
 
while the error message is '
ERROR: Variable Make in list does not match type prescribed for this list.
ERROR: Variable Model in list does not match type prescribed for this list.'
6 REPLIES 6
Reeza
Super User

Make and Model are character variables/categorical variables. 

 

You can use them in PROC GLM if that's the model you're trying to build. Also, you don't necessarily need to subset your data ahead of time, you can use the KEEP data set option. 

 

proc glm data=sashelp.cars (keep = msrp make model);
class make model;
model msrp = make model;
run;

PS. This doesn't make logical sense, but I'm assuming you're just trying things. FYI - the first e-course on Statistics and SAS is free. 

 


@bioresearch wrote:

I am trying to run a regeression program on sashelp.car using KEEP statement and here is the code that I used;

 

data auto;
set sashelp.cars;
keep make model MSRP;
run;
proc reg data=auto;
model MSRP=make model;
run;

and the log is;

 

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc reg data=auto;
74 model MSRP=make model;
ERROR: Variable Make in list does not match type prescribed for this list.
ERROR: Variable Model in list does not match type prescribed for this list.
NOTE: The previous statement has been deleted.
75 run;
 
WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
76
77
78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
 
while the error message is '
ERROR: Variable Make in list does not match type prescribed for this list.
ERROR: Variable Model in list does not match type prescribed for this list.'

 

bioresearch
Calcite | Level 5

This actually produced a valid statement but did not give me what I intended to bring out of the output.

 

Therefore, I need more solutions.

 

Thanks very much.

Reeza
Super User

@bioresearch wrote:

This actually produced a valid statement but did not give me what I intended to bring out of the output.

 

Therefore, I need more solutions.

 

Thanks very much.


How are we suppose to know your 'intentions'? 

 

 

bioresearch
Calcite | Level 5
What I want is to run a regression analysis of that data.

##- Please type your reply above this line. No attachm Ients. -##
Reeza
Super User

'regression analysis' is vague. Are you looking to run a linear or logistic regression model? What's your independent variable? What's your dependent variable? Running a linear regression analysis with only two categorical variables doesn't make a heck of a lot of sense in practical terms. 

 

 


@bioresearch wrote:
What I want is to run a regression analysis of that data.

##- Please type your reply above this line. No attachm Ients. -##



utrocketeng
Quartz | Level 8

seems as though you are trying to do linear regression with Character predictors.  try this example for a linear regression with continuous factors:

 

data auto;
set sashelp.cars;
/*keep make model MSRP;*/
run;

proc reg data=auto;
model MSRP=EngineSize Cylinders;
run;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 1457 views
  • 5 likes
  • 3 in conversation