BookmarkSubscribeRSS Feed
d0021
Calcite | Level 5

I'm trying to create dummy variables using proc glmmod. My inputs are two macro variables. Catvarlist has all the categorical variables. Varlist has all the variables. 

 

proc glmmod data=test outdesign=want outparm=p noprint;
class &catvarlist;
model Predicted = &varlist;
run;



/*Create rename statement automatically
THIS WILL NOT WORK IF YOUR VARIABLE NAMES WILL END UP OVER 32 CHARS*/
data p;
set p;
if _n_=1 and effname='Intercept' then var='Col1=Intercept';
else var= catt("Col", _colnum_, "=", catx("_", effname, vvaluex(effname)));
run;

proc sql;
select var into :rename_list separated by " "
from p;
quit;


/*Rename variables*/
proc datasets library=work nodetails nolist;
modify want;
rename &rename_list;
run;quit;


proc print data=want;
run;

 

I am getting the following error with Proc GLMMOD.

ERROR: Variable name should be either numeric or specified in the CLASS statement.
ERROR: No MODEL statement.

 

Please advise.

3 REPLIES 3
Reeza
Super User
Show your macro variable and the log as well, with the MPRINT and SYMBOLGEN code.
ballardw
Super User

@d0021 wrote:

I'm trying to create dummy variables using proc glmmod. My inputs are two macro variables. Catvarlist has all the categorical variables. Varlist has all the variables. 

 

proc glmmod data=test outdesign=want outparm=p noprint;
class &catvarlist;
model Predicted = &varlist;
run;



/*Create rename statement automatically
THIS WILL NOT WORK IF YOUR VARIABLE NAMES WILL END UP OVER 32 CHARS*/
data p;
set p;
if _n_=1 and effname='Intercept' then var='Col1=Intercept';
else var= catt("Col", _colnum_, "=", catx("_", effname, vvaluex(effname)));
run;

proc sql;
select var into :rename_list separated by " "
from p;
quit;


/*Rename variables*/
proc datasets library=work nodetails nolist;
modify want;
rename &rename_list;
run;quit;


proc print data=want;
run;

 

I am getting the following error with Proc GLMMOD.

ERROR: Variable name should be either numeric or specified in the CLASS statement.
ERROR: No MODEL statement.

 

Please advise.


Sounds like you have a Character variable in &varlist that is not in &catvarlist

Examine your variable characteristics.

PaigeMiller
Diamond | Level 26

@d0021 wrote:

I'm trying to create dummy variables using proc glmmod. My inputs are two macro variables. Catvarlist has all the categorical variables. Varlist has all the variables. 

 

I am getting the following error with Proc GLMMOD.

ERROR: Variable name should be either numeric or specified in the CLASS statement.
ERROR: No MODEL statement.


One (or more) of the variables in &VARLIST are character variables and so this one (or more) variable need to be also in &CATVARLIST.

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1077 views
  • 2 likes
  • 4 in conversation