Announcement

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

  • about synth instruction question

    hello great master
    I have a question
    My stata version is 14
    when I perform the instruction, it always displays the error message
    what can I do?

    ////stata instruction///
    xtset state year
    replace age15to24 = 100*age15to24
    synth cigsale cigsale(1988) cigsale(1980) cigsale(1975) lnincome retprice ///
    age15to24 beer(1984(1)1988), trunit(3) trperiod(1989)

    file synthopt.plugin not found <-------error message
    (error occurred while loading synth.ado)


    /////data////
    clear
    input long state float(year cigsale lnincome beer age15to24 retprice cigsale_cal cigsale_rest)
    1 1970 89.8 . . 1788.618 39.6 . 120.08421
    1 1971 95.4 . . 1799.2784 42.7 . 123.86316
    1 1972 101.1 9.498476 . 1809.939 42.3 . 129.17896
    1 1973 102.9 9.550107 . 1820.5994 42.1 . 131.53947
    1 1974 108.2 9.537163 . 1831.26 43.1 . 134.66843
    1 1975 111.7 9.540031 . 1841.9207 46.6 . 136.93158
    1 1976 116.2 9.591908 . 1852.581 50.4 . 141.26053
    1 1977 117.1 9.617496 . 1863.242 50.1 . 141.08948
    1 1978 123 9.654072 . 1873.9023 55.1 . 140.47368
    1 1979 121.4 9.64918 . 1884.563 56.8 . 138.08684
    1 1980 123.2 9.612194 . 1895.2234 60.6 . 138.08948
    1 1981 119.6 9.609594 . 1858.4222 68.8 . 137.98685
    1 1982 119.1 9.59758 . 1821.621 73.1 . 136.29474
    1 1983 116.3 9.626769 . 1784.8202 84.4 . 131.25
    1 1984 113 9.671621 18 1748.019 90.8 . 124.90263
    1 1985 114.5 9.703193 18.7 1711.218 99 . 123.1158
    1 1986 116.3 9.74595 19.3 1674.4167 103 . 120.59473
    1 1987 114 9.762092 19.4 1637.6157 110 . 117.58685
    1 1988 112.1 9.78177 19.4 1600.8146 114.4 . 113.82368
    1 1989 105.6 9.802527 19.4 1564.0134 122.3 . 109.66315
    1 1990 108.6 9.81429 20.1 1527.2124 139.1 . 105.66579
    1 1991 107.9 9.81926 20.1 . 144.4 . 104.3421
    1 1992 109.1 9.845286 20.4 . 172.2 . 103.39474
    1 1993 108.5 9.85216 20.3 . 176.2 . 102.69473
    1 1994 107.1 9.879334 21 . 154.6 . 102.11842
    1 1995 102.6 9.924404 20.6 . 155.1 . 103.1579
    1 1996 101.4 9.940027 21 . 158.3 . 101.18421
    1 1997 104.9 9.93727 20.8 . 167.4 . 101.78947
    1 1998 106.2 . . . 180.5 . 100.9579
    1 1999 100.7 . . . 195.6 . 97.59473
    1 2000 96.2 . . . 270.7 . 92.13421
    2 1970 100.3 . . 1690.0676 36.7 . 120.08421
    2 1971 104.1 . . 1699.5386 38.8 . 123.86316
    2 1972 103.9 9.464514 . 1709.0095 44.1 . 129.17896
    2 1973 108 9.55683 . 1718.4805 45.1 . 131.53947
    2 1974 109.7 9.542286 . 1727.9513 45.5 . 134.66843
    2 1975 114.8 9.514094 . 1737.4224 48.6 . 136.93158
    2 1976 119.1 9.558153 . 1746.8933 50.9 . 141.26053
    2 1977 122.6 9.590923 . 1756.364 52.6 . 141.08948
    2 1978 127.3 9.657238 . 1765.835 56.5 . 140.47368
    2 1979 126.5 9.633533 . 1775.306 58.4 . 138.08684
    2 1980 131.8 9.573803 . 1784.777 61.5 . 138.08948
    2 1981 128.7 9.593041 . 1750.1112 64.7 . 137.98685
    2 1982 127.4 9.5737 . 1715.4453 72.1 . 136.29474
    2 1983 128 9.593053 . 1680.7794 82 . 131.25
    2 1984 123.1 9.65044 17.9 1646.1138 93.6 . 124.90263
    2 1985 125.8 9.675527 18.1 1611.448 98.5 . 123.1158
    2 1986 126 9.705939 18.7 1576.782 103.6 . 120.59473
    2 1987 122.3 9.705574 19 1542.1163 113 . 117.58685
    2 1988 121.5 9.721532 18.9 1507.4504 119.9 . 113.82368
    2 1989 118.3 9.73737 19 1472.7847 127.7 . 109.66315
    2 1990 113.1 9.736311 19.9 1438.119 141.2 . 105.66579
    2 1991 116.8 9.743068 19.9 . 146.5 . 104.3421
    2 1992 126 9.788629 20 . 177.3 . 103.39474
    2 1993 113.8 9.785142 19.7 . 179.9 . 102.69473
    2 1994 108.8 9.813631 19.7 . 168.1 . 102.11842
    2 1995 113 9.86446 19.5 . 167.3 . 103.1579
    2 1996 110.7 9.885234 20.1 . 167.1 . 101.18421
    2 1997 108.7 9.883107 19.8 . 181.3 . 101.78947
    2 1998 109.5 . . . 187.3 . 100.9579
    2 1999 104.8 . . . 206.9 . 97.59473
    2 2000 99.4 . . . 279.3 . 92.13421
    3 1970 123 . . 1781.5833 38.8 123 .
    3 1971 121 . . 1792.9636 39.7 121 .
    3 1972 123.5 9.930814 . 1804.344 39.9 123.5 .
    3 1973 124.4 9.955092 . 1815.724 39.9 124.4 .
    3 1974 126.7 9.947999 . 1827.1044 41.9 126.7 .
    3 1975 127.1 9.937167 . 1838.4847 45 127.1 .
    3 1976 128 9.976858 . 1849.865 48.3 128 .
    3 1977 126.4 10.0027 . 1861.2454 49 126.4 .
    3 1978 126.1 10.045565 . 1872.6255 58.7 126.1 .
    3 1979 121.9 10.054688 . 1884.0057 60.1 121.9 .
    3 1980 120.2 10.03784 . 1895.386 62.1 120.2 .
    3 1981 118.6 10.028626 . 1855.3705 66.4 118.6 .
    3 1982 115.4 10.01253 . 1815.355 72.8 115.4 .
    3 1983 110.8 10.031737 . 1775.3394 84.9 110.8 .
    3 1984 104.8 10.07536 25 1735.324 94.9 104.8 .
    3 1985 102.8 10.099703 24 1695.3083 98 102.8 .
    3 1986 99.7 10.127267 24.7 1655.2927 104.4 99.7 .
    3 1987 97.5 10.1343 24.1 1615.277 103.9 97.5 .
    3 1988 90.1 10.141663 23.6 1575.2615 117.4 90.1 .
    3 1989 82.4 10.142313 23.7 1535.246 126.4 82.4 .
    3 1990 77.8 10.141623 23.8 1495.2303 163.8 77.8 .
    3 1991 68.7 10.110714 22.3 . 186.8 68.7 .
    3 1992 67.5 10.11494 21.3 . 201.9 67.5 .
    3 1993 63.4 10.098497 20.8 . 205.1 63.4 .
    3 1994 58.6 10.099508 20.1 . 190.3 58.6 .
    3 1995 56.4 10.155916 19.7 . 195.1 56.4 .
    3 1996 54.5 10.178637 19.1 . 197.9 54.5 .
    3 1997 53.8 10.17519 19.5 . 200.3 53.8 .
    3 1998 52.3 . . . 207.8 52.3 .
    3 1999 47.2 . . . 224.9 47.2 .
    3 2000 41.6 . . . 351.2 41.6 .
    4 1970 124.8 . . 1909.5022 29.4 . 120.08421
    4 1971 125.5 . . 1916.476 31.1 . 123.86316
    4 1972 134.3 9.805548 . 1923.4497 31.2 . 129.17896
    4 1973 137.9 9.848413 . 1930.4232 32.7 . 131.53947
    4 1974 132.8 9.840451 . 1937.397 38.1 . 134.66843
    4 1975 131 9.828461 . 1944.3706 41.7 . 136.93158
    4 1976 134.2 9.858913 . 1951.344 44.8 . 141.26053
    end

  • #2
    The synth command is a user-written command available from SSC. From ssc describe synth we see that synthopt.plugin is one of the files it installs. Apparently your copy of the synth package was not installed correctly, and the synth command is unable to locate the synthopt.plugin file. Try
    Code:
    ssc install synth, replace
    to reinstall the package.

    Comment


    • #3
      My question is that I really have done the step, but it still fails.

      Comment


      • #4
        After launching Stata I immediately ran the following.
        Code:
        . synth
        file synthopt.plugin not found
        (error occurred while loading synth.ado)
        r(601);
        
        . ssc install synth, replace
        checking synth consistency and verifying not already installed...
        installing into /Users/lisowskiw/Library/Application Support/Stata/ado/plus/...
        installation complete.
        
        . synth
        time variable not set, use tsset varname ...
        r(111);
        
        .
        What happens when you launch Stata and do the same? Copy from your Results window and paste to your post, as I did here, using code delimiters [CODE] and [/CODE] to surround your output and ensure ts readability.

        Comment


        • #5
          I have run "ssc install synth, replace"
          But the result is the same as follow:
          Attached Files

          Comment


          • #6
            Very strange. Try
            Code:
            . adopath
            . clear all
            
            . adopath
              [1]  (BASE)      "/Applications/Stata/ado/base/"
              [2]  (SITE)      "/Applications/Stata/ado/site/"
              [3]              "."
              [4]  (PERSONAL)  "/Users/lisowskiw/Library/Application Support/Stata/ado/personal/"
              [5]  (PLUS)      "/Users/lisowskiw/Library/Application Support/Stata/ado/plus/"
              [6]  (OLDPLACE)  "~/ado/"
            
            . ssc install synth, replace
            checking synth consistency and verifying not already installed...
            all files already exist and are up to date.
            
            . which synth.ado
            /Users/lisowskiw/Library/Application Support/Stata/ado/plus/s/synth.ado
            *! version 0.0.7  Jens Hainmueller 01/26/2014
            
            . which synthopt.plugin
            /Users/lisowskiw/Library/Application Support/Stata/ado/plus/s/synthopt.plugin
            
            . program synthopt, plugin
            
            .
            and see if that finds it and loads it. (The final program command is what is failing when it is run from within synth.ado.)

            Comment


            • #7
              I have tried, but it still no work
              Attached Files

              Comment


              • #8
                Please do not post screen shots. Take a few moments to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using code delimiters [CODE] and [/CODE], as described in section 12 of the FAQ.

                To present data, code, and results readably, please copy them from the Results window or elsewhere and paste them into a code block in the Forum editor, as explained in the Statalist FAQ linked to at the top of the page. For example, the following:

                [CODE]
                // sample code
                sysuse auto, clear
                describe
                [/CODE]

                will be presented in the post as the following:
                Code:
                // sample code
                sysuse auto, clear
                describe
                Your screenshot does not show the results of all the commands I asked you to run. But having seen what you showed in post #7, please run the following commands, and copy the commands and their output from Stata's Results window and paste them into a CODE block in your next post. Select the entire group of commands in your do-file editor window and run them all at once.
                Code:
                clear all
                ssc uninstall synth
                adopath
                ssc install synth, replace
                dir "`c(sysdir_plus)'/s"
                program synthopt, plugin

                Comment


                • #9
                  is it like this as follow:

                  //////////////////////////////////
                  . clear all

                  . ssc uninstall synth

                  package synth from http://fmwww.bc.edu/repec/bocode/s
                  'SYNTH': module to implement Synthetic Control Methods for Comparative Case S
                  > tudies

                  (package uninstalled)

                  . adopath
                  [1] (BASE) "C:\Program Files (x86)\Stata14\ado\base/"
                  [2] (SITE) "C:\Program Files (x86)\Stata14\ado\site/"
                  [3] "."
                  [4] (PERSONAL) "c:\ado\personal/"
                  [5] (PLUS) "c:\ado\plus/"
                  [6] (OLDPLACE) "c:\ado/"

                  . ssc install synth, replace
                  checking synth consistency and verifying not already installed...
                  installing into c:\ado\plus\...
                  installation complete.

                  . dir "`c(sysdir_plus)'/s"
                  <dir> 1/02/20 11:00 s

                  . program synthopt, plugin
                  file synthopt.plugin not found
                  r(601);

                  end of do-file

                  Comment


                  • #10
                    Please change
                    Code:
                    dir "`c(sysdir_plus)'/s"
                    to
                    Code:
                    dir "c:\ado\plus/s/*"
                    and try again. The objective is to list all the files in the "s" subdirectory. I don't have Windows to test the syntax, what I wrote worked on macOS.

                    Comment


                    • #11
                      OK thanks
                      the result as follow:
                      ////////////////////////////////////////
                      . clear all

                      . ssc uninstall synth

                      package synth from http://fmwww.bc.edu/repec/bocode/s
                      'SYNTH': module to implement Synthetic Control Methods for Comparative Case S
                      > tudies

                      (package uninstalled)

                      . adopath
                      [1] (BASE) "C:\Program Files (x86)\Stata14\ado\base/"
                      [2] (SITE) "C:\Program Files (x86)\Stata14\ado\site/"
                      [3] "."
                      [4] (PERSONAL) "c:\ado\personal/"
                      [5] (PLUS) "c:\ado\plus/"
                      [6] (OLDPLACE) "c:\ado/"

                      . ssc install synth, replace
                      checking synth consistency and verifying not already installed...
                      installing into c:\ado\plus\...
                      installation complete.

                      . dir "c:\ado\plus/s/*"
                      <dir> 1/02/20 12:22 .
                      <dir> 1/02/20 12:22 ..
                      10.8k 11/12/17 23:16 seeout.ado
                      1.3k 11/12/17 23:16 seeout.hlp
                      1.8k 11/20/19 20:43 sepscatter.ado
                      4.7k 11/20/19 20:43 sepscatter.sthlp
                      1.9k 11/12/17 23:16 shellout.ado
                      2.9k 11/12/17 23:16 shellout.hlp
                      5.0k 10/13/18 11:20 sjlatex.ado
                      7.9k 10/13/18 11:20 sjlatex.hlp
                      10.9k 10/13/18 11:20 sjlog.ado
                      8.7k 10/13/18 11:20 sjlog.hlp
                      11.5k 10/13/18 11:20 sjlog_7.ado
                      8.4k 11/16/17 0:46 sk_distdicho.ado
                      10.2k 11/16/17 0:46 sk_distdicho.sthlp
                      4.9k 11/16/17 0:46 sk_distdichoi.ado
                      0.0k 11/16/17 0:46 sk_distdichoi.sthlp
                      1.5k 2/08/18 15:09 sxpose.ado
                      2.2k 2/08/18 15:09 sxpose.hlp
                      32.3k 1/02/20 12:22 synth.ado
                      22.8k 1/02/20 12:22 synth.sthlp
                      1.2k 1/02/20 12:22 synth_ll.ado

                      . program synthopt, plugin
                      file synthopt.plugin not found
                      r(601);

                      Comment


                      • #12
                        Thank you. This confirms that the net install command (that is run by the ssc install command) is failing to install the plugin. Without going into lengthy detail here, I have traced the problem to an oversight in preparing the "package" file submitted to SSC. As a consequence, while the output of the ssc describe synth command asserts it will run under versions of Stata as old as version 9.2 the plugin will not be installed into Stata for Windows versions older than 15.0. I will report this to the developer.

                        Here is how you can work around this problem.

                        1. You are running Windows. In Stata confirm whether you have a 64-bit version of Stata or a 32-bit version.
                        Code:
                        . display c(bit)
                        64
                        2. In your web browser, go to the location from which synth is installed.

                        http://fmwww.bc.edu/repec/bocode/s/

                        3. Scroll down to the bottom of the (very long page) where you will see the following.
                        Code:
                        [   ]    synth.ado            28-Jan-2014 10:45    32K     
                        [   ]    synth.hlp            06-Oct-2011 09:07    22K     
                        [   ]    synth.html           19-Feb-2013 16:55    23K     
                        [   ]    synth.pkg            24-Jul-2018 15:45    1.1K     
                        [   ]    synth.sthlp          31-Jul-2018 16:00    23K     
                        [   ]    synth_ll.ado         12-Aug-2013 13:49    1.2K     
                        [   ]    synth_smoking.dta    24-Jul-2018 15:35    37K     
                        [   ]    synthopt.linux32     14-Apr-2011 16:37    28K     
                        [   ]    synthopt.linux64     06-Jun-2012 14:44    28K     
                        [   ]    synthopt.mac         22-Jul-2009 08:35    133K     
                        [   ]    synthopt.win32       12-Mar-2007 14:34    112K     
                        [   ]    synthopt.win64       24-Sep-2011 15:45    115K
                        4. Select either synthopt.win64 or synthopt.win32 (whichever corresponds to your version of Stata for Windows from step 1) and download it to your Windows system, renaming the file to synthopt.plugin in the process.

                        5. In Windows, move synthopt.plugin to the c:\ado\plus\s\ directory.

                        6. In Stata, run
                        Code:
                        . clear all
                        
                        . synth
                        time variable not set, use tsset varname ...
                        r(111);
                        which confirms that the plugin was found and loaded.

                        Comment


                        • #13
                          Dear William. Thank you for this earlier post. Can help me troubleshoot a very similar issue on my Mac running Bis Sur OS with the new Apple chips with Stata/MP 17.0?

                          Code:
                          //the original error was:
                          Could not load plugin: /Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin
                          (error occurred while loading synth.ado)
                          r(9999);
                          
                          //So I first uninstalled syth
                          . ssc uninstall synth
                          
                          //Then I reintalled from the writer's website
                          net from "https://web.stanford.edu/~jhain/Synth"
                          -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                          https://web.stanford.edu/~jhain/Synth/
                          Synthetic Control Methods for Comparative Case Studies
                          -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                          
                          Alberto Abadie, Kennedy School of Government, Harvard University and NBER
                          Jens Hainmueller, Department of Political Science, MIT
                          Alexis Diamond, IFC
                          
                          Also see the homepage for the paper that describes the method.
                          
                          PACKAGES you could -net describe-:
                              synth             Synthetic Control Methods
                          -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                          
                          . net install synth, all replace force
                          checking synth consistency and verifying not already installed...
                          
                          the following files will be replaced:
                              /Users/demattee/Library/Application Support/Stata/ado/plus/s/synth.ado
                              /Users/demattee/Library/Application Support/Stata/ado/plus/s/synth_ll.ado
                              /Users/demattee/Library/Application Support/Stata/ado/plus/l/lsynth_mata_subr.mlib
                              /Users/demattee/Library/Application Support/Stata/ado/plus/s/synth.sthlp
                              smoking.dta
                          
                          installing into /Users/demattee/Library/Application Support/Stata/ado/plus/...
                          installation complete.
                          
                          copying into current directory...
                                copying  smoking.dta
                          ancillary files successfully copied.
                          
                          
                          //Then I tried to replicate the example in the help file
                          //load dataset
                          . sysuse smoking, clear
                          (Tobacco Sales in 39 US States)
                          
                          //declare the dataset as panel:
                          . tsset state year
                          
                          Panel variable: state (strongly balanced)
                           Time variable: year, 1970 to 2000
                                   Delta: 1 unit
                          
                          //Example 1 - Construct synthetic control group:
                          . synth cigsale beer(1984(1)1988) lnincome retprice age15to24 cigsale(1988) cigsale(1980) cigsale(1975), trunit(3) trperiod(1989)
                          Could not load plugin: /Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin
                          (error occurred while loading synth.ado)
                          
                          //Alas the same error message. 
                          
                          
                          //Following your steps from post #6 produces this output:
                          . adopath
                            [1]  (BASE)      "/Applications/Stata/ado/base/"
                            [2]  (SITE)      "/Applications/Stata/ado/site/"
                            [3]              "."
                            [4]  (PERSONAL)  "/Users/demattee/Documents/Stata/ado/personal/"
                            [5]  (PLUS)      "/Users/demattee/Library/Application Support/Stata/ado/plus/"
                            [6]  (OLDPLACE)  "~/ado/"
                          
                          . clear all
                          . adopath
                            [1]  (BASE)      "/Applications/Stata/ado/base/"
                            [2]  (SITE)      "/Applications/Stata/ado/site/"
                            [3]              "."
                            [4]  (PERSONAL)  "/Users/demattee/Documents/Stata/ado/personal/"
                            [5]  (PLUS)      "/Users/demattee/Library/Application Support/Stata/ado/plus/"
                            [6]  (OLDPLACE)  "~/ado/"
                          
                          . ssc install synth, replace
                          ssc install: "synth" not found at SSC, type search synth
                          (To find all packages at SSC that start with s, type ssc describe s)
                          
                          //synth not found at SSC! So I tired this:
                          . net from "https://web.stanford.edu/~jhain/Synth"
                          
                          . which synth.ado
                          /Users/demattee/Library/Application Support/Stata/ado/plus/s/synth.ado
                          *! version 0.0.6  Jens Hainmueller 08/12/2013
                          
                          . which synthopt.plugin
                          /Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin
                          
                          . program synthopt, plugin
                          dlopen(/Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin, 1): no suitable image found.  Did find:
                                          /Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin: no matching architecture in universal wrapper
                                          /Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin: no matching architecture in universal wrapper
                          Could not load plugin: /Users/demattee/Library/Application Support/Stata/ado/plus/s/synthopt.plugin
                          
                          
                          //These are the specs for my machine and software
                          . about
                          Stata/MP 17.0 for Mac (Apple Silicon)
                          Revision 20 Apr 2021
                          Copyright 1985-2021 StataCorp LLC
                          Total physical memory: 16.00 GB
                          Stata license: Single-user 2-core network, expiring 27 May 2021
                          
                          . display c(bit)
                          64

                          Comment


                          • #14
                            The problem is that the authors of synth have yet to provide a version of the synthopt plugin that has been compiled to run in "native mode" on Apple Silicon.

                            I copied the following advice given by Chinh Nguyen (StataCorp) from a similar thread:

                            If there aren't Apple Silicon native versions of your third party tools yet, then you can force Stata to run under Rosetta 2 so that it'll run the Intel version of Stata. From the Finder, select the Stata application then select the File > Get Info menu item. Check the Open Using Rosetta checkbox.
                            After you launch Stata using Rosetta, confirm that Stata is indeed running the macOS Intel executable.
                            Code:
                            . display c(machine_type)
                            Macintosh (Intel 64-bit)
                            This confirms macOS is running the Stata "universal application" using the Intel version of the macOS executable rather than the Apple Silicon version (both of which are included in the universal application), and thus when the plugin is run, the macOS Intel version included within it will be identified and run.

                            I hope. Please report back if this is successful. Or not.


                            Comment


                            • #15
                              Good morning William. I appreciate your quick reply. Your suggestion worked and things are running smoothly again. Glad the fix was this easy!

                              Comment

                              Working...
                              X