BookmarkSubscribeRSS Feed
jaimedba
Fluorite | Level 6

Below is my code, which is producing the same results. With the different output file names, and different regression variables, I would expect different results. I separated the two with #### to indicate a 'break' in the two requests. The bold/underlined text is what changes between the two.

 

Any help is greatly appreciated! I've been looking over this forever...does anyone see the problem that I cannot find?

 

/*BB: 3e*/
ods exclude all; /* suppress tables to screen */
ods output FitStatistics=RegEq3e_Output; /* contains results for each BY group */
proc reg data=temp.Equation3_interactions plots=none;
by datacqtr;
model lead_prccq = epsq bvpsq BB_Real_GDP_Q
BB_EPS BB_BV
cfpsq cashpsq dvpspq rdpsq
intanpsq spipsq ocipsq revpsq atpsq change_revtpsq
capxpsq cogspsq xsgapsq FF;
quit;
ods exclude none; /* no longer suppress tables */

proc print data=RegEq3e_Output noobs;
where Label2="Adj R-Sq";
var datacqtr Label2 nValue2;
title 'Rsquared Values for Full Regression Equation 3 BB';
run;

/*To keep only the Adj Rsquared Rows*/
data temp.RegEq3e_Output; set work.RegEq3e_Output;
where Label2="Adj R-Sq";
keep datacqtr Label2 nValue2;
run;

/*Merge the Adj Rsquared data with the Quarter from Econ Vars*/
proc sql;
create table temp.RegEq3e_QTR
as select *
from temp.RegEq3e_Output as a, work.EconVarFile as b
where a.datacqtr=b.datacqtr;
quit;

proc print data=temp.RegEq3e_QTR noobs;
where Label2="Adj R-Sq";
var datacqtr Label2 nValue2 datacqtrQ;
title 'Rsquared for Full Equation with Quarterly Time Variable BB';
run;

/*BB (Bloomberg Real GDP):*/
proc reg data=temp.RegEq3e_QTR plots=none;
model nValue2 = datacqtrQ;
title 'Full Regression Equation 4 BB';
run;
quit;

/*###################################################################*/

/*Jensen: 3f*/
ods exclude all; /* suppress tables to screen */
ods output FitStatistics=RegEq3f_Output; /* contains results for each BY group */
proc reg data=temp.Equation3_interactions plots=none;
by datacqtr;
model lead_prccq = epsq bvpsq jen_calc
jen_EPS jen_BV
cfpsq cashpsq dvpspq rdpsq
intanpsq spipsq ocipsq revpsq atpsq change_revtpsq
capxpsq cogspsq xsgapsq FF;
quit;
ods exclude none; /* no longer suppress tables */

proc print data=RegEq3f_Output noobs;
where Label2="Adj R-Sq";
var datacqtr Label2 nValue2;
title 'Rsquared Values for Full Regression Equation 3 Jensen';
run;

/*To keep only the Adj Rsquared Rows*/
data temp.RegEq3f_Output; set work.RegEq3f_Output;
where Label2="Adj R-Sq";
keep datacqtr Label2 nValue2;
run;

/*Merge the Adj Rsquared data with the Quarter from Econ Vars*/
proc sql;
create table temp.RegEq3f_QTR
as select *
from temp.RegEq3f_Output as a, work.EconVarFile as b
where a.datacqtr=b.datacqtr;
quit;

proc print data=temp.RegEq3f_QTR noobs;
where Label2="Adj R-Sq";
var datacqtr Label2 nValue2 datacqtrQ;
title 'Rsquared for Full Equation with Quarterly Time Variable Jensen';
run;

/*Jensen (Monetary Policy):*/
proc reg data=temp.RegEq3f_QTR plots=none;
model nValue2 = datacqtrQ;
title 'Full Regression Equation 4 Jensen';
run;
quit;

 

3 REPLIES 3
Patrick
Opal | Level 21

First things I'd be doing:

- Check the log for Warnings and Errors - and also read the SAS Notes if there is something "telling" in it.

- Execute the two versions in fresh and independent SAS sessions. This to ensure that steps in the 2nd version can't just pick-up work tables created by the first version.

 

jaimedba
Fluorite | Level 6

Thank you for your help! I do get this warning in the log, but I think that's okay?

 

WARNING: Variable datacqtr already exists on file TEMP.REGEQ3F_QTR.

 

 

ChrisNZ
Tourmaline | Level 20

> I do get this warning in the log, but I think that's okay?

 

Probably not. It means that the variable REGEQ3F_QTR from table work.EconVarFile  is dropped when you join the tables:

  proc sql;
    create table temp.RegEq3f_QTR as
    select *
    from temp.RegEq3f_Output as a, work.EconVarFile as b
    where a.datacqtr=b.datacqtr;
  quit;

If this what you want?

Never leave warnings in the log. Never.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 474 views
  • 2 likes
  • 3 in conversation