1. Run proc reg with the acov option.
Like so:
proc reg data=mydata;
model y = x / acov;
run;
This prints the robust covariance matrix, but reports the usual OLS standard errors and t-stats.
To get robust t-stats, save the estimates and the robust covariance matrix. This can't be done the usual way (as with outest for the parameters), because there is no corresponding option for the robust covariance matrix. Instead use ODS:
proc reg data=mydata outest=estimates;
model y = x /acov;
ods output acovest=covmat parameterestimates=parms;
run;
Then read in the robust covariance matrix - named covmat - and divide your coefficients by the square root of the diagonal elements. This is a headache, so instead just use one of the options below.
2. Use proc model.
proc model data=mydata;
instruments x;
y=b0+b1*x;
fit y / gmm kernel=(bart,1,0);
run;
Notice that you get Newey-West errors by fiddling around with the second and third options of the kernel.
3. Cluster your data such that each observation is its own cluster, and then run a regression to get clustered standard errors. SAS produces White standard errors.
A. Use proc surveyreg with an appropriate cluster variable.
data mydata;
set mydata;
counter=_n_;
run;
proc surveyreg data=mydata;
cluster counter;
model y=x;
run;
B. Use proc genmod, again with an appropriate cluster variable.
data mydata;
set mydata;
counter=_n_;
run;
proc genmod data=mydata;
class counter;
model y=x;
repeated subject=counter /type=ind;
run;
The type=ind says that observations are independent across "clusters".
The code that produces the estimates using all the methods above is here. You can test the code using Mitchell Petersen's data, and compare your results with his. The results using that data are here: log file , lst file .