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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2054 views
  • 0 likes
  • 2 in conversation