Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ask for Help on Synthetic Difference-in-Differences (sdid) graph code - error r(4023)

    Hello Stata users:

    I got stuck on a coding issue of sdid graph as I want to show the parallel trend graph after adjusting the weights by sdid. I referred to the document of Dr. Daniel Pailanir Daniel PV on Github and compiled a similar code for my case, however I always got error message `r(4023)' saying `class member function not found' after I run the estimation regardless using Stata18 or Stata15. Then I came to Statalist to search for help, I did `ssc install blindschemes', `set plotplain permanent', also I tried arranging the code in different rows, however none of them worked. Could someone give any advice? I put the code below for your information.
    Any advice would be appreciated!

    *************first I run the code like this*************************

    Code:
    sdid lskillgap_ratio adminid year hsr, vce(bootstrap) reps(100) seed(123)
         graph g1on g1_opt(xtitle("") ylabel(-5(0)5) scheme(plotplainblind))
         g2_opt(ylabel(0(5)10) xlabel(2008(1)2018) ytitle("Lagged skillgap_ratio") xtitle("city") text( "ATT = -0.01553" "SE = (0.00363)") scheme(plotplainblind)) graph_export(sdid_1, .png)
    *************then I also tried to put them in different lines like below**********************
    Code:
    graph g1on ///
           g1_opt( ///
           xtitle("") ylabel(-5(0)5) scheme(plotplainblind) ///
           ) ///
         g2_opt( ///
           ylabel(0(5)10) xlabel(2008(1)2018) ytitle("Lagged skillgap_ratio") ///
                xtitle("city") text( "ATT = -0.01553" "SE = (0.00363)") scheme(plotplainblind) ///
                      )
        graph_export(sdid_1, .png)


    I also cue some experts in this field that might know the answers, thank you so much!
    Daniel PV, Jared Greathouse, Maxence Morlet, Clyde Schechter

    Meng
    PhD student
    Ohio State Univeristy

  • #2
    Uh, why are you not using /// to break up your lines of code? I don't think it causes the problem, I'm just curious.


    Actually I lied, I think it does. Stata looks at graph and then it checks if the first thing follwing it is a class of graph (bar, histogram). Because you're not breaking up your code lines, I THINK this causes the error, but I'm not at my computer to test this, and you don't give your data/an example dataset so I couldn't text it if I wanted to.

    Comment


    • #3
      If a command line starts

      Code:
      graph g1on 
      then that will certainly fail. Beyond that I would start with

      Code:
       
       sdid lskillgap_ratio adminid year hsr, vce(bootstrap) reps(100) seed(123) graph g1on
      to try to narriw the problem down.

      Comment


      • #4
        Hi Nick Cox

        Thank you so much for replying me! Together taking the suggestion from Jared Greathouse, I tried below format (please see code below), and this time error r(4023) disappeared!
        However, I received a new error saying "new variables cannot be uniquely named or already defined". I don't think there's any new variable in the graph code...I got confused what does this error mean..
        Here I attach a test data for inspection use.
        Many thanks!!

        Best,
        Meng

        Code:
        sdid lskillgap_ratio adminid year hsr, vce(bootstrap) reps(100) seed(123) graph g1on ///
             g1_opt(xtitle("") ylabel(-5(0)5) scheme(plotplainblind)) ///
             g2_opt(ylabel(0(5)10) xlabel(2008(1)2018) ytitle("Lagged skillgap_ratio") xtitle("city") text( "ATT = -0.01553" "SE = (0.00363)")  ///
             scheme(plotplainblind)) graph_export(sdid, .png)
        Attached Files

        Comment


        • #5
          Hello everyone, I see the problem and the last one Venessa Yu is a temporary name in the sdid command. I fixed this problem in the github version (the problem is only in that version that we are currently developing and improving a couple of sections). Reinstall and make sure the auxiliary variables are not in the data (maybe they are some that appear after the first time you run the command).

          Comment


          • #6
            Originally posted by Daniel PV View Post
            Hello everyone, I see the problem and the last one Venessa Yu is a temporary name in the sdid command. I fixed this problem in the github version (the problem is only in that version that we are currently developing and improving a couple of sections). Reinstall and make sure the auxiliary variables are not in the data (maybe they are some that appear after the first time you run the command).
            Yes, thanks so much, Daniel PV Prof. Pailañir! I was a idiot and did clear the auxiliary variables everytime, that's why I repeatedly got error saying "new variables cannot be uniquely named or already defined". Also, using "vce(noinference)" can get quick graph and ATT with skipping bootstrap iteration, which you have to wait for a while if you have a list of estimations to run.

            Also, thanks everyone Nick Cox Jared Greathouse for your attention!

            Best,
            Meng

            Comment

            Working...
            X