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

Hi,

I have a gmm model, and I estimated 16 parameters. I only care about the intercept. Is it possible to output only one parameter in stead of all. I have the following code.

ods output parameterestimates=final;

proc model data = current;

  endo Mean;

  exog x1 x2 x3 x4 x11 x12 x13 x14 x15;

  instruments _exog_;

  parms b0 b1 b2 b3 b4 b11 b12 b13 b14 b15;

  Mean=b0+b1*x1+b2*x2+b3*x3+b4*x4+b11*x11+b12*x12+b13*x13+b14*x14+b15*x15;

  fit Mean/ gmm kernel=(bart,4,0) vardef=n;

run;

quit;

I only want b0 to be presented.

1 ACCEPTED SOLUTION

Accepted Solutions
esjackso
Quartz | Level 8

I believe in the ods statement it would be a where statement similar to the proc print mentioned above:

ods output parameterestimates=final (where=(parameter='b0');


EJ

View solution in original post

9 REPLIES 9
SteveDenham
Jade | Level 19

Since you are outputting the parameter estimates to  the dataset final, could you just use PROC PRINT with a WHERE parameter='b0'; statement.  You could suppress the listing for proc model with ods listing close; and just output the estimate, standard error, etc. as needed.

Steve Denham

SeanZ
Obsidian | Level 7

I am not sure, but I don't think proc print can output the parameters to a dataset.

SteveDenham
Jade | Level 19

Sorry.  My statement was very unclear.  My problem was with the ODS statements.  I solved them using ODS HTML rather than ODS LISTING.  I was able to output only the values in the 'final' dataset, and suppress all of the output from PROC MODEL.

Steve Denham

Vince28_Statcan
Quartz | Level 8

cycling through proc model documentation, it supports the keep statement

So you could add

keep b0;

right before run; to achieve the desired result. At least according to documentation.

SeanZ
Obsidian | Level 7

Thank you. EJ gave the correct answer.

Reeza
Super User

Add a keep in with your ODS statement, I don't know what the variable is actually called so make sure you have the correct name:

ods output parameterestimates=final (keep=b0);

proc model data = current;

  endo Mean;

  exog x1 x2 x3 x4 x11 x12 x13 x14 x15;

  instruments _exog_;

  parms b0 b1 b2 b3 b4 b11 b12 b13 b14 b15;

  Mean=b0+b1*x1+b2*x2+b3*x3+b4*x4+b11*x11+b12*x12+b13*x13+b14*x14+b15*x15;

  fit Mean/ gmm kernel=(bart,4,0) vardef=n;

run;

quit;

esjackso
Quartz | Level 8

I believe in the ods statement it would be a where statement similar to the proc print mentioned above:

ods output parameterestimates=final (where=(parameter='b0');


EJ

SteveDenham
Jade | Level 19

This last works for me.  I have problems with ods listing close or ods exclude all in ETS, the former not doing anything, and the latter not allowing print when a subsequent procedure (PROC PRINT) is used.

Steve Denham

SeanZ
Obsidian | Level 7

Thanks. There is no variable named b0 in the output. b0 b1 ... are variables listed under variable parameter. EJ gave the correct answer.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

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
  • 9 replies
  • 1091 views
  • 3 likes
  • 5 in conversation