BookmarkSubscribeRSS Feed
mahler_ji
Obsidian | Level 7

Hello all,

I have the following proc reg macro that I would like to output the regression parameters into data sets, but I cannot get it to work.  The following code works:

%macro regA(dat, port);  
proc reg data = &dat;
  model &port = A B C D E;
 
  restrict B = 0;

run;
%mend regA;

%regA(a3, core);

However, when I add the following statement (which I use all the time) after the restrict statement:

outest out = regA_&port

I get an error.

Thanks in advance

5 REPLIES 5
PaigeMiller
Diamond | Level 26

It doesn't go in the RESTRICT statement, it goes in PROC REG

It's OUTEST and not OUTSET

If you type PROC REG DATA=&dat OUTEST=regA_&port you will get an error if the value of &port doesn't product a valid SAS data set name.

So what error do you get? Show us the relevant part of the SASLOG.

--
Paige Miller
mahler_ji
Obsidian | Level 7

Sorry, the OUTEST was a typo.  I have fixed it in the original post.

Here is the code that I am using:

%macro regA(dat, port) ; 

proc reg data = &dat;

  model &port =A B C D E;

  restrict B = 0;

  outest out = regA_&port;

run;

%mend regA;

And here is the error that I am receiving:

NOTE: The previous statement has been deleted.

ERROR 180-322: Statement is not valid or it is used out of proper order.

And I tried to put the outest statement in the top line along with the proc reg statement, but then my restrict statement didn't work?

the sas dataset name is allowable.

Thanks,

PaigeMiller
Diamond | Level 26

The relevant part of the SASLOG includes not only the error message, but some meaningful portion of the code in the SASLOG.

--
Paige Miller
mahler_ji
Obsidian | Level 7

Update:  I think that I got the output statement to work with the following code:

%macro regA(dat, port); 

proc reg data = &dat outest = regA_&port;

  model &port = A B C D E;

  restrict B = 0;

run;

quit;

%mend regA;

But now it is only outputting the regression coefficients into the output dataset and not any of the statistics information like the tstat or the pvalue.

Am I using the wrong output statement!?

Thanks,

PaigeMiller
Diamond | Level 26

You need the TABLEOUT option in the PROC REG statement.

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 1677 views
  • 0 likes
  • 2 in conversation