-------------
      name:  <unnamed>
       log:  C:\D\projekte\Replication McCabe_Snyder\McCabe_Snyder_ReStat_Table_7.smcl
  log type:  smcl
 opened on:  24 Mar 2017, 13:23:58

.
. **********************************************************************
. *
. * Program McCabe_Snyder_ReStat_Table_7.DO
. *
. * Runs regressions for quintile results in Table 7.
. *
. * McCabe & Snyder August 2013
. *
. **********************************************************************
.
. **********************************************************************
. *
. * Note on computation of subscription elasticity. Take marginal effect,
. * which is IRR - 1.  Then multiply by mean number of subscribers.
. * Relevant means are provided after each regression.
. *
. **********************************************************************
.
. * Set initial Stata parameters
. version 12

. set more 1

. set matsize 4000

. #delimit ;
delimiter now ;
. use McCabe_Snyder_ReStat_combined;

. drop if quintile_merge==1;
(7,016 observations deleted)

. summ;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     journal |     53,437    74.91826    52.95059          4        229
       pyear |     53,437    1978.912    11.34399       1956       2003
       cyear |     53,437    1995.579    6.626804       1982       2005
cusa_sing_~h |     53,437    11.30567     18.9154          0        225
ceng_sing_~h |     53,437    3.803881     6.31396          0        114
-------------+---------------------------------------------------------
ceur_sing_~h |     53,437    3.212924    6.122137          0         95
coth_sing_~h |     53,437    1.234744    2.647411          0         49
        issn |          0
    fpubdate |     53,437     1947.17    26.34838       1844       1988
        own1 |     53,437    .0026012     .050936          0          1
-------------+---------------------------------------------------------
      jstor1 |     53,437     .028033    .1650687          0          1
    ingenta1 |     53,437    .0030503    .0551459          0          1
   proquest1 |     53,437     .013006    .1133007          0          1
      ebsco1 |     53,437    .0404776    .1970783          0          1
       gale1 |     53,437    .0029568    .0542961          0          1
-------------+---------------------------------------------------------
       oclc1 |     53,437    .0000749    .0086516          0          1
        own2 |     53,437     .019013    .1365719          0          1
      jstor2 |     53,437    .1335591    .3401812          0          1
    ingenta2 |     53,437    .0052772    .0724534          0          1
   proquest2 |     53,437    .0878418    .2830673          0          1
-------------+---------------------------------------------------------
      ebsco2 |     53,437     .092333    .2894982          0          1
       gale2 |     53,437    .0363606    .1871874          0          1
       oclc2 |     53,437    .0153826    .1230701          0          1
        cusa |     53,437    22.33153    37.69173          0        404
        ceng |     53,437    6.634261    11.15632          0        180
-------------+---------------------------------------------------------
        ceur |     53,437    5.974138    11.75381          0        201
        coth |     53,437    2.329304    4.915915          0        100
        cmis |     53,437    .5808709    1.290282          0         22
       digz1 |     53,437    .0002807     .016752          0          1
       digz2 |     53,437    .0001871    .0136786          0          1
-------------+---------------------------------------------------------
   elsevier1 |     53,437    .0094317    .0966586          0          1
   elsevier2 |     53,437    .0482999    .2144011          0          1
  blackwell1 |     53,437    .0009731    .0311798          0          1
  blackwell2 |     53,437     .006924     .082923          0          1
     ingaoc1 |     53,437    .0033872    .0581013          0          1
-------------+---------------------------------------------------------
     ingaoc2 |     53,437    .0498531    .2176434          0          1
    jss2_usa |     53,437    .7879939    2.380356          0      10.96
    jss2_eng |     53,437    .1146052    .3549092          0       1.76
    jss2_eur |     53,437    .1495361    .4985781          0       2.77
    jss2_oth |     53,437    .1695971    .5927203          0       3.49
-------------+---------------------------------------------------------
        jss2 |     53,437    1.221732    3.759804          0      18.98
     es2_usa |     53,437    .0124655    .0828088          0       1.15
     es2_eng |     53,437    .0208986    .1380406          0       1.87
     es2_eur |     53,437    .0104682    .0688195          0         .9
     es2_oth |     53,437    .0123269    .0828579          0       1.15
-------------+---------------------------------------------------------
         es2 |     53,437    .0561592    .3716368          0       5.07
      cit_20 |     53,437    2.984674    5.791662          0        103
   cit_20_40 |     53,437    3.355802    7.523935          0        342
   cit_40_60 |     53,437    4.079439    8.433056          0        133
   cit_60_80 |     53,437    6.533713    13.20245          0        158
-------------+---------------------------------------------------------
      cit_80 |     53,437    20.89648    36.55057          0        562
quintile_m~e |     53,437           3           0          3          3
 fraction_80 |     47,512    .1456506    .1143043   .0034483   .8333333
   cit_total |     53,437     37.8501    61.84056          0        771
   obs_count |     53,437    76.51734    65.93491          6        706
-------------+---------------------------------------------------------
  count_null |     47,512    65.06432    66.12943          0        672
count_obs_80 |     47,512    8.419031    7.482008          1         67

. * Set threshold to screen out observations forcing us to estimate;
. * OA variables with few degrees of freedom behind them;
. gen threshold = 10;

.  ***************************************************************;
.  *** Create cyear variables and journal volume fixed effects ***;
.  ***************************************************************;
. forvalues num = 1956/2005 {;
  2.     quietly gen byte py`num' = (pyear == `num');
  3.      };

. forvalues x = 80/99 {;
  2.      quietly gen byte c`x' = (cyear == 1900 + `x');
  3.       };

.  forvalues x = 0/4 {;
  2.      quietly gen byte c0`x' = (cyear == 2000 + `x');
  3.       };

. * create journal volume fixed effect groups;
.  sort journal pyear;

.  egen volume = group(journal pyear);

.  *******************************************************************;
. *** Generate digitization variables                              ***;
. ********************************************************************;
. * Generate channel count variables;
. gen partial = own1 + elsevier1 + jstor1 + ingenta1 + gale1 + oclc1 +  blackwell1 + ebsco1 + proquest1 + digz1;

. gen full    = own2 + elsevier2 + jstor2 + ingenta2 + gale2 + oclc2 +  blackwell2 + ebsco2 + proquest2 + digz2;

. gen other_partial = own1 + ingenta1 + gale1 + oclc1 +  blackwell1 + ebsco1 + proquest1 + digz1;

. gen other_full    = own2 + ingenta2 + gale2 + oclc2 +  blackwell2 + ebsco2 + proquest2 + digz2;

. * Generate other variables;
. gen op = (other_partial > 0) & (other_full == 0);

. gen os = (other_partial == 0) & (other_full == 1);

. gen oh = (other_partial > 0) & (other_full == 1);

. gen om = other_full >= 2;

. * JSTOR partial dummy;
. gen jp  = jstor1 > 0;

. * JSTOR subs variables;
. gen jsfs = jss2 * (jstor1 == 0) * (jstor2 == 1) * (other_partial == 0) * (other_full == 0);

. gen jsfp = jss2 * (jstor1 == 0) * (jstor2 == 1) * (other_partial > 0) * (other_full == 0);

. gen jsfd = jss2 * (jstor1 == 0) * (jstor2 == 1) * (other_full >= 1);

. * Elsevier dummies for partial access and full access to current content;
. gen ep  = elsevier1 > 0;

. gen ecf = (elsevier1 == 0) * (elsevier2 == 1) * (es2 == 0);

. * Elsevier subs;
. gen esf = es2 * (elsevier1 == 0) * (elsevier2 == 1);

. * Dummies for screening;
. gen jsfs_dum = jsfs > 0;

. gen jsfp_dum = jsfp > 0;

. gen jsfd_dum = jsfd > 0;

. gen esf_dum = esf > 0;

. * Interact with citation-year blocks;
. gen c95_99 = (cyear >= 1995 & cyear <= 1999);

. gen c00_05 = (cyear >= 2000 & cyear <= 2005);

. foreach abbrev in op os oh om jp ep ecf {;
  2.    quietly gen `abbrev'95 = `abbrev' * c95_99;
  3.    quietly gen `abbrev'00 = `abbrev' * c00_05;
  4.    };

. drop c95_99 c00_05 op os oh om jp ep ecf;

. * Generate remaining variables;
. gen cit = cusa + ceng + ceur + coth + cmis;

. gen age = cyear - pyear;

. gen age2 = age^2;

. gen age3 = age^3;

. gen age4 = age^4;

. save temp_quintile, replace;
(note: file temp_quintile.dta not found)
file temp_quintile.dta saved

.  **********************************************************************;
.  *** 1956-1965                                                      ***;
.  **********************************************************************;
.  gen plower = 1956;

.  gen pupper = 1965;

.  keep if pyear >= plower & pyear <= pupper;
(45,181 observations deleted)

.  * Create fixed effects for publication x citation year interactions;
.  * Drop the 2005 cyear to avoid multicolinearity with the constant;
.  * Don't create variables with pyear after cyear;
.  * Do create variables with pyear = cyear since keeping age0 = 1 observations;
.  forvalues y = 56/99 {;
  2.       forvalues x = 80/99 {;
  3.          quietly gen ip`y'c`x' = py19`y' * c`x' if
>          (`x' >= `y')
>         & (1900 + `y' >= plower)
>        & (1900 + `y' <= pupper);
  4.      };
  5.   };

.  forvalues y = 56/99 {;
  2.      forvalues x = 0/4 {;
  3.         quietly gen ip`y'c0`x' = py19`y' * c0`x' if
>          (1900 + `y' >= plower)
>         & (1900 + `y' <= pupper);
  4.      };
  5.   };

.  forvalues y = 0/5 {;
  2.       forvalues x = 0/4 {;
  3.          quietly gen ip0`y'c0`x' = py200`y' * c0`x' if
>          (`x' >= `y')
>         & (2000 + `y' >= plower)
>         & (2000 + `y' <= pupper);
  4.       };
  5.   };

.  foreach var of varlist ip* {;
  2.       capture assert !missing(`var');
  3.      if _rc {;
  4.          drop `var';
  5.       };
  6.    };

. egen title = group(journal);

. rename journal smournal;

. quietly tabulate title, generate(journal);

. drop title;

.  foreach var of varlist journal* {;
  2.       quietly gen ia1`var' = age * `var';
  3.       quietly gen ia2`var' = age2 * `var';
  4.       quietly gen ia3`var' = age3 * `var';
  5.       quietly gen ia4`var' = age4 * `var';
  6.    };

. rename smournal journal;

.  * avoid multicolinearity by dropping first journal's age profile;
.  drop ia1journal1 ia2journal1 ia3journal1 ia4journal1;

. * screen for small numbers within digitization categories;
. foreach var in op95 op00 os95 os00 oh95 oh00 om95 om00
>                jp95 jp00
>                ep95 ep00 ecf95 ecf00
>                jsfs_dum jsfp_dum jsfd_dum esf_dum {;
  2.    quietly egen countvar = total(`var' > 0);
  3.    drop if (countvar <= threshold) & (`var' > 0);
  4.    drop countvar;
  5.    };
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)

. * apply second screen to pick up newly created small categories;
. foreach var in op95 op00 os95 os00 oh95 oh00 om95 om00
>                jp95 jp00
>                ep95 ep00 ecf95 ecf00
>                jsfs_dum jsfp_dum jsfd_dum esf_dum {;
  2.    quietly egen countvar = total(`var' > 0);
  3.    drop if (countvar <= threshold) & (`var' > 0);
  4.    drop countvar;
  5.    };
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)

. * Run regression;
. xtpqml cit_80   ip* ia1j* ia2j*
>            op95 op00 os95 os00 oh95 oh00 om95 om00
>            jp95 jp00
>            ep95 ep00 ecf95 ecf00
>            jsfs jsfp jsfd esf,
>            i(volume) irr fe cluster(journal);
note: 56 groups (1344 obs) dropped because of all zero outcomes
note: ip56c80 dropped because of collinearity
note: ip56c81 dropped because of collinearity
note: ip57c80 dropped because of collinearity
note: ip57c81 dropped because of collinearity
note: ip58c80 dropped because of collinearity
note: ip58c81 dropped because of collinearity
note: ip59c80 dropped because of collinearity
note: ip59c81 dropped because of collinearity
note: ip60c80 dropped because of collinearity
note: ip60c81 dropped because of collinearity
note: ip61c80 dropped because of collinearity
note: ip61c81 dropped because of collinearity
note: ip62c80 dropped because of collinearity
note: ip62c81 dropped because of collinearity
note: ip63c80 dropped because of collinearity
note: ip63c81 dropped because of collinearity
note: ip64c80 dropped because of collinearity
note: ip64c81 dropped because of collinearity
note: ip65c80 dropped because of collinearity
note: ip65c81 dropped because of collinearity
note: ia1journal25 dropped because of collinearity
note: ia2journal25 dropped because of collinearity
note: op95 dropped because of collinearity
note: os95 dropped because of collinearity
note: oh95 dropped because of collinearity
note: om95 dropped because of collinearity
note: ep95 dropped because of collinearity
note: ep00 dropped because of collinearity
note: ecf95 dropped because of collinearity
note: ecf00 dropped because of collinearity
note: esf dropped because of collinearity

--Break--
r(1);

end of do-file

--Break--
r(1);

. exit, clear