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.
@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.
@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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.