BookmarkSubscribeRSS Feed
Saba1
Quartz | Level 8

Hi

 

I have panel data and using the Instrumental Variable approach with 2SLS by using the following code:

 

proc syslin data=have 2sls first;
   endogenous  Female_Mgr;
   instruments Change_Female_Population Grad MBA Fund_Ret Fund_Size Fund_Flow Fund_Age;
   model Y = Female_Mgr Grad MBA Fund_Ret Fund_Size Fund_Flow Fund_Age ;
run;

Here endogenous variable is "Female_Mgr", a dummy variable and instrumental variable is "Change_female_population". This code works well. But I need to include "Year and Industry Fixed Effect" and "Huber-White Robust Standard Error" in 2SLS. I am struggling to find a code that can fulfill these requirements. Please help. Thanks.

6 REPLIES 6
xyz0505
SAS Employee

Hi, 

If you have sas viya 3.4 you can try PROC CPANEL. For example, if you have a panel data with id and time to be firm and year, dependent variable to be cost, independent variable to be production (endogenous) and iv, instrumental variable to be iv2, the code is following:

 

proc cpanel data = Electricity;
id firm year;
endogenous production ;
instruments iv2;
model cost = production iv/ ivfixtwo printfixed robust;
run;

 

should be able to give you the heteroskedasticity robust standard error with twoway fixed effects.

Saba1
Quartz | Level 8
@xyz0505: Unfortunately I have only sas 9.4. Is there any other solution to this problem?
xyz0505
SAS Employee

Hi,

From the PANEL related procs side, there's no other solution as far as I know.

Saba1
Quartz | Level 8
@xyz0505 : Right, thanks though. By the way if I want time and firm-level fixed effect along-with robust standard errors in a normal OLS regression (not 2SLS), which proc is best suited?
xyz0505
SAS Employee

PANEL and CPANEL can do that,

 

proc panel data = Electricity; 
   id firm year;
   model cost = production iv/ hccme=0 cluster;
run;

 

will give clustered s.e clustering on firm.

YIN_YI_JEN
Obsidian | Level 7

Hi @Saba1,

I've been struggling to figure out the same problem as you did.

I would like to run a 2SLS regression on my panel data, and I also need to include firm and year fixed effects and cluster standard errors at firm level. 

It's frustrated to find that similar problems posted on SAS community seems to end up being unsolved.

I was wondering if you eventually fixed this. If you did, could you tell me how?

Thank you.

 

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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 2332 views
  • 2 likes
  • 3 in conversation