Announcement

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

  • How to write the synth command

    I am using the synthetic control method from Abadie, Gardeazabal, Diamond and Hainmueller available at http://www.stanford.edu/~jhain/software.htm#Synth. My version of STATA is STATA15. I have 93 quarterly observations on gdp for 45 countries. I am trying to create a synthetic economy for the 35th country using the gdp observations from the other 44 countries. The only way I can get the command to work is to use the code given below, which is extremely cumbersome. Using alternatives - such as synth gdp gdp(1 2:86), trunit(35) trperiod(87) nested fig - do not work. Is there any way to write the command more economically?

    synth gdp gdp(1) gdp(2) gdp(3) gdp(4) gdp(5) gdp(6) gdp(7) gdp(8) gdp(9) gdp(10) gdp(11) gdp(12) gdp(13) gdp(14) gdp(15) gdp(16) gdp(17) gdp(18) gdp(19) gdp(20) gdp(21) gdp(22) gdp(23) gdp(24) gdp(25) gdp(26) gdp(27) gdp(28) gdp(29) gdp(30) gdp(31) gdp(32) gdp(33) gdp(34) gdp(35) gdp(36) gdp(37) gdp(38) gdp(39) gdp(40) gdp(41) gdp(42) gdp(43) gdp(44) gdp(45) gdp(46) gdp(47) gdp(48) gdp(49) gdp(50) gdp(51) gdp(52) gdp(53) gdp(54) gdp(55) gdp(56) gdp(57) gdp(58) gdp(59) gdp(60) gdp(61) gdp(62) gdp(63) gdp(64) gdp(65) gdp(66) gdp(67) gdp(68) gdp(69) gdp(70) gdp(71) gdp(72) gdp(73) gdp(74) gdp(75) gdp(76) gdp(77) gdp(78) gdp(79) gdp(80) gdp(81) gdp(82) gdp(83) gdp(84) gdp(85) gdp(86),trunit(35) trperiod(87) nested fig

  • #2
    If there is a help file attached to this command, you may want to consult it. Otherwise, contact the author. If you are entering everything manually, consider the following:

    Code:
    forval i= 1/86{
    local gdpi "`gdpi' gdp(`i')"
    }
    di "`gdpi'"
    Resulting in


    Code:
     
    . di "`gdpi'"
     gdp(1) gdp(2) gdp(3) gdp(4) gdp(5) gdp(6) gdp(7) gdp(8) gdp(9) gdp(10) gdp(11) gdp(12) gdp(13) gdp(14) gdp(15) gdp(16) gdp(17) gdp(18) gdp(19) gd
    > p(20) gdp(21) gdp(22) gdp(23) gdp(24) gdp(25) gdp(26) gdp(27) gdp(28) gdp(29) gdp(30) gdp(31) gdp(32) gdp(33) gdp(34) gdp(35) gdp(36) gdp(37) gd
    > p(38) gdp(39) gdp(40) gdp(41) gdp(42) gdp(43) gdp(44) gdp(45) gdp(46) gdp(47) gdp(48) gdp(49) gdp(50) gdp(51) gdp(52) gdp(53) gdp(54) gdp(55) gd
    > p(56) gdp(57) gdp(58) gdp(59) gdp(60) gdp(61) gdp(62) gdp(63) gdp(64) gdp(65) gdp(66) gdp(67) gdp(68) gdp(69) gdp(70) gdp(71) gdp(72) gdp(73) gd
    > p(74) gdp(75) gdp(76) gdp(77) gdp(78) gdp(79) gdp(80) gdp(81) gdp(82) gdp(83) gdp(84) gdp(85) gdp(86).

    Therefore, you can simply use

    Code:
     synth gdp `gdpi', trunit(35) trperiod(87) nested fig

    Comment


    • #3
      Thanks very much. That works.

      Comment

      Working...
      X