Help using Base SAS procedures

proc reg output

Reply
Frequent Contributor
Posts: 101

proc reg output

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

Trusted Advisor
Posts: 1,932

Re: proc reg output

Posted in reply to mahler_ji

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.

Frequent Contributor
Posts: 101

Re: proc reg output

Posted in reply to PaigeMiller

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,

Trusted Advisor
Posts: 1,932

Re: proc reg output

Posted in reply to mahler_ji

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

Frequent Contributor
Posts: 101

Re: proc reg output

Posted in reply to PaigeMiller

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,

Trusted Advisor
Posts: 1,932

Re: proc reg output

Posted in reply to mahler_ji

You need the TABLEOUT option in the PROC REG statement.

Ask a Question
Discussion stats
  • 5 replies
  • 640 views
  • 0 likes
  • 2 in conversation