BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alicewong
Calcite | Level 5

Hi Everyone,

I want to use fixed effects to estimate a model, using GMM estimation and the model consists of simultaneous equations. I am using PROC MODEL (proc panel does not support simultaneous equations) and using dummy variable to control the fixed effects.

Since there are 100+ dummy variables, does that mean I need to create 100+ parameters corresponding to these 100+ dummy variables? Is there any efficient way to add the dummy variables when using PROC MODEL? Generate 100+ parameters for the dummy variable is too much burden...

Suppose the simultaneous eq. model is like this:


y1=a0+a1*x1+a2*x2

y2=b0+b1*x1+b2*x3


After adding the dummy variables, the model will be like this??!!


y1=a0+a1*x1+a2*x2+a3*col1+a4*col2+a5*col3+....a102*col100+...

y2=b0+b1*x1+b2*x3+b3*col1+b4*col2+b5*col3+....b102*col100+...


Is there any easy way to write the dummy variables and the corresponding parameters,  like col1-c100 in PROC MODEL?


Thanks very much.


Alice.

1 ACCEPTED SOLUTION

Accepted Solutions
Linlin
Lapis Lazuli | Level 10

do you want to try the code below?

data _null_;
length list $ 2000;
retain list;
  do i=1 to 20;
  list=catx('+',list,cats(cats('a',i+2),'*',cats('col',i)));
  end;
call symputx('list',list);
run;

%put &list;


y1=a0+a1*x1+a2*x2+&list.;

Linlin

View solution in original post

3 REPLIES 3
Linlin
Lapis Lazuli | Level 10

do you want to try the code below?

data _null_;
length list $ 2000;
retain list;
  do i=1 to 20;
  list=catx('+',list,cats(cats('a',i+2),'*',cats('col',i)));
  end;
call symputx('list',list);
run;

%put &list;


y1=a0+a1*x1+a2*x2+&list.;

Linlin

Reeza
Super User

You can reference this paper that has a macro explaining how to create the macro variables.

http://www.wuss.org/proceedings11/Papers_Sun_B_74902.pdf

I'm not 100% sure but think LinLin's code will create the code, but won't create the dummy variables.

oloolo
Fluorite | Level 6

if you have SAS/STAT, use PROC GLMMOD, to output parameter  and associated column numbers and use SQL to create your statement:

proc glmmod data=sashelp.cars outparm=parm;

        class type;

        model MPG_CITY=TYPE;

run;

proc sql noprint;

        select cats('a', _colnum_, '*col', _colnum_) into :stmt separated by '+'

        from    parm

;

quit;

%put &stmt;

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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