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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1207 views
  • 2 likes
  • 4 in conversation