Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- two stage least squares coding problem

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-03-2020 04:28 AM
(351 views)

Syntax error occurs when I run 2SLS, but the data should be fine as the file I attached. I think the problem might be the part of running regression, but I don't know where wrong.

my first stage function is : batie = ln_ta ROA leverage growth age CPA big4 ibsize loss loss_lag liquidity INVplusAR_TA btm employ LD

where "batie" is an endogenous variable, "employ" and "LD" are Instrument Variables for batie, other variables are exogenous variable ;

my second stage function is : am = batie ln_ta ROA leverage growth age CPA big4 ibsize loss loss_lag liquidity INVplusAR_TA btm ;

SAS code are as following:

`libname ok 'd:\all\ipo';`

run;

proc model data=ok.www;
instruments employ LD;
batie = ln_ta ROA leverage growth age CPA big4 ibsize loss loss_lag liquidity INVplusAR_TA btm employ LD;
am = batie ln_ta ROA leverage growth age CPA big4 ibsize loss loss_lag liquidity INVplusAR_TA btm ;
fit batie am / 2sls outv=vdata vardef=n kernel=(bart,0,);
title '2sls results';
run;
quit;

How can I fix this?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

PROC MODEL requires that your model is specified using a mathematical expression including explicit parameters rather than just using a list of variables. To do a two stage least squares estimation for your model you could use something like the following:

```
proc model data=new;
am = p_batie*batie + p_ln_ta*ln_ta + p_ROA*ROA + p_leverage*leverage + p_growth*growth + p_age*age
+ p_CPA*CPA + p_big4*big4 + p_ibsize*ibsize + p_loss*loss + p_loss_lag*loss_lag
+ p_liquidity*liquidity + p_INVplusAR_TA*INVplusAR_TA + p_btm*btm;
fit am / 2sls outv=vdata vardef=n kernel=(bart,0,);
instruments _exog_ employ LD;
title '2sls results';
quit;
```

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

PROC MODEL requires that your model is specified using a mathematical expression including explicit parameters rather than just using a list of variables. To do a two stage least squares estimation for your model you could use something like the following:

```
proc model data=new;
am = p_batie*batie + p_ln_ta*ln_ta + p_ROA*ROA + p_leverage*leverage + p_growth*growth + p_age*age
+ p_CPA*CPA + p_big4*big4 + p_ibsize*ibsize + p_loss*loss + p_loss_lag*loss_lag
+ p_liquidity*liquidity + p_INVplusAR_TA*INVplusAR_TA + p_btm*btm;
fit am / 2sls outv=vdata vardef=n kernel=(bart,0,);
instruments _exog_ employ LD;
title '2sls results';
quit;
```

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.