Announcement

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

  • Error while replicating FlexPanelDID command

    Hi. I am trying to run the flexpaneldid command as described in the paper that introduced it (https://papers.ssrn.com/sol3/papers....act_id=3692458) but it gives me the error message below. I then ran the flexpaneldid_preprocessing just in case, but the resulting dataset no longer has the dependent variable 'patents' or the treatment variable 'treatment' as described in the paper anymore. As a result the flexpaneldid command as in the paper no longer can be run.

    Has anyone else had success in replicating this code? And if so, what should I be doing?

    Code:
    Error message: #1
    
     use "http://fmwww.bc.edu/RePEc/bocode/f/flexpaneldid_example_data.dta", clear
    
    . flexpaneldid patents, id(cusip ) treatment(treatment ) time(year ) statmatchin
    > g(con(employ stckpr rnd sales ) cat(pats_cat rndstck_cat )) outcometimerelstar
    > t(3 ) outcomedev(-2 ) test
    
    
    ********************************************************************************
    ************************* flexpaneldid *****************************************
    ********************************************************************************
    
    --------------------------------------------------------------------------------
    outcome:                patents
    id:                     cusip
    treatment:              treatment
    time:                   year
    outcome_time_start:     3
    outcome_time_end:       .
    outcome_dev:            -2
    cemmatching:            
    statmatching:           con(employ stckpr rnd sales ) cat(pats_cat rndstck_cat )
    test:                   test
    outcomemissing:         
    didmodel:               
    --------------------------------------------------------------------------------
    invalid file specification
    r(198);
    
    
    
    
    Error message: #2
    
    use "http://fmwww.bc.edu/RePEc/bocode/f/flexpaneldid_example_data.dta", clear
    
    flexpaneldid_preprocessing, id(cusip) treatment(treatment) time(year) matchvar
    > s(employ stckpr rnd sales pats_cat rndstck_cat) matchtimerel(-1) matchvarsexac
    > t(sic_cat) prepdataset("preprocessed_data.dta") replace
    
    
    ********************************************************************************
    ************************* flexpaneldid - preprocessing *************************
    ********************************************************************************
    
    --------------------------------------------------------------------------------
    id:                     cusip
    treatment:              treatment
    time:                   year
    matchvars:              employ stckpr rnd sales pats_cat rndstck_cat
    matchvarsexact:         sic_cat
    match_time:             -1
    prepdataset:            preprocessed_data.dta
    --------------------------------------------------------------------------------
    
    
    ********************************************************************************
    ************************* Preprocessing ****************************************
    ********************************************************************************
    
    Preprocessing of 61 treated: 
    .................................................. 50 
    ........... 61
    
    ********************************************************************************
    ************************* Preprocessing - Summary ******************************
    ********************************************************************************
    
    Number of treated:                                    61
    Number of treated dropped during preprocessing:        0
    Number of treated after preprocessing:                61
    Mean size of selection groups:                   45.7377
    
    . flexpaneldid patents, id(cusip ) treatment(treatment ) time(year ) statmatchin
    > g(con(employ stckpr rnd sales ) cat(pats_cat rndstck_cat )) outcometimerelstar
    > t(3 ) outcomedev(-2 ) test
    variable patents not found

  • #2
    Does anyone know how to do this? I've tried several different approaches, but they all seem to fail

    Comment


    • #3
      I think I got this to work for me by doing the following:

      1. Run the pre-processing first using the following code and save it in the same file where you have saved the example dataset. The example dataset can be obtained from "http://fmwww.bc.edu/RePEc/bocode/f", under the link flexpaneldid_example_data.dta.

      To the run the pre-processing, first load the flexpaneldid_example_data.dta and the use the code
      flexpaneldid_preprocessing, id(cusip) treatment(treatment) time(year) matchvars(employ stckpr rnd sales return pats_cat rndstck_cat rndeflt_cat ) matchtimerel(-1 ) matchvarsexact(sic_cat ) prepdataset('preprocessed_data.dta') replace

      Save this newly created file in the same folder as your flexpaneldid_example_data.dta.

      2. Load the flexpaneldid_example_data.dta again. Now run the flexpanel did code. But remember that under

      "prepdataset("preprocessed_data.dta") replace" at the end, you need the whole path of where the preprocessed_data.dta is stored within the parenthesis. Make sure the filename of the preprocessed data is exactly correct and then it should work.

      Comment

      Working...
      X