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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 645 views
  • 2 likes
  • 4 in conversation