did icon indicating copy to clipboard operation
did copied to clipboard

option / required r(198);

Open HJeongMN opened this issue 3 years ago • 7 comments

Hi Nick.

First, thank you so much for providing such great resources on the did package. I am super new on this synchronizing R and Stata thing and I am trying this only to use Callaway & Sant'Anna (2020)'s did package.

While I was trying with the example data and the code, mpdta, clear att_gt lemp year firsttreat lpop, idname(countyreal)

the following message keeps showing up. option / required r(198);

I am not sure what went wrong. I would appreciate it if you could help me with this issue. Thank you!

Best regards, Hyoju Jeong

HJeongMN avatar May 16 '21 04:05 HJeongMN

That's very strange. It seems to think there's an option called / that's required, which there isn't. Unless for some reason it's reading the continue-line code (///) as text

Are you perhaps using Stata 17?

NickCH-K avatar May 16 '21 05:05 NickCH-K

Thank you for your replay. I am using Stata 16. I uninstalled and installed everything again, and now I have the following errors when I am trying with the example data and commends. att_gt_error

So, if I run it without using 'rcall' it works fine, but after using 'rcall' Stata keeps showing me the same error message "Error: unexpected symbol in "try({ att_gt lemp" " I tried with my own data, but it kept showing the same message. I would appreciate it if you could help me with the issue. Thank you!

HJeongMN avatar May 17 '21 04:05 HJeongMN

Oh, yeah, you're not supposed to run it using rcall. It uses rcall internally; the idea is that you use did so you don't have to use R/Rcall yourself.

NickCH-K avatar May 17 '21 04:05 NickCH-K

Oh, that was why! Thank you so much for clarifying the issue.

So, I am now running with my own data, and I can't get it work. I keep having errors like this. First, since 'rcall: summary(CS_Model)' does not work, it is probably not the issue of rcall not being able to brining back and I am not sure where to look to find problems. Second, I am not sure how to specify weights in this code. [iweight=cem_weights] is how I usually put in OLS after CEM. Screen Shot 2021-05-17 at 12 03 40 PM My study period is from 2014 to 2018 with groups that had entry(treatment) in every year from 2015-2018 with groups that never have treatment. strtyear | Freq. Percent Cum. ------------+----------------------------------- 0 | 50,574 78.03 78.03 2015 | 5,445 8.40 86.44 2016 | 3,754 5.79 92.23 2017 | 2,992 4.62 96.84 2018 | 2,045 3.16 100.00 ------------+----------------------------------- Total | 64,810 100.00

I am not sure If i am generating too many number of combinations...Also, removing y2014 y2015 y2016 y2017 also generate the same error message.

Thank you!

HJeongMN avatar May 17 '21 17:05 HJeongMN

I'm recommending a switch over to the Stata-native https://github.com/friosavila/csdid_drdid

NickCH-K avatar May 23 '21 20:05 NickCH-K

@NickCH-K : I tried to find where the stray / appears but could not spot it quickly. As far as the required iweight goes, your code neither enforces the use of the weight, nor produces the default. I think att_gt.ado would need something like

    syntax [iweight /]
    * Stata parses weight by putting it into exp, and you need [iweight /] with a slash to make it clean without the equal sign
    if "`exp'" == "" {
          tempvar iwvar
          gen byte `iwvar' = 1
          local iweght iw=`iwvar'
    }

BTW that [weight /] thing is what may be manifesting as "option / required". Not sure.

skolenik avatar Nov 02 '21 14:11 skolenik

This is good to know! I'm not really supporting this package at this point given the Stata-native alternative, but I'll keep this in mind.

NickCH-K avatar Nov 03 '21 21:11 NickCH-K