BookmarkSubscribeRSS Feed
TorTheHammer
Fluorite | Level 6

Hello and good day. 

I'm running the code below for my project but it takes very long time, so I wondered if it was a way ... so that it did not print? 🙂  



"Running a Fama-Macbeth regression in SAS is quite easy, and doesn't require any special macros. The following code will run cross-sectional regressions by year for all firms and report the means.

 

ods listing close;
ods output parameterestimates=pe;
proc reg data=dset;
 by year;
 model depvar = indvars; run;
quit;
ods listing;

proc means data=pe mean std t probt;
 var estimate; class variable;
run;

Since the results from this approach give a time-series, it is common practice to use the Newey-West adjustment for standard errors. Unlike Stata, this is somewhat complicated in SAS, but can be done as follows:

 

proc sort data=pe; by variable; run;

%let lags=3;
ods output parameterestimates=nw;
ods listing close;
proc model data=pe;
 by variable;
 instruments / intonly;
 estimate=a;
 fit estimate / gmm kernel=(bart,%eval(&lags+1),0) vardef=n; run;
quit;
ods listing;

proc print data=nw; id variable;
 var estimate--df; format estimate stderr 7.4;
run;

"

1 REPLY 1
Reeza
Super User

Look at ODS SELECT and ODS EXCLUDE. It allows you to control the output and suppressing the output can speed up your processes.

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!

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.

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
  • 1 reply
  • 1038 views
  • 2 likes
  • 2 in conversation