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
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.
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,
The relevant part of the SASLOG includes not only the error message, but some meaningful portion of the code in the SASLOG.
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,
You need the TABLEOUT option in the PROC REG statement.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.