Announcement

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

  • #16
    Yes, I misremembered the rc that Chris got.

    What is interesting is that the "invalid syntax" error message is not consistent with rc 111 - I thought it was some sort of generic, but in fact it is the precise message for rc 197 - reporting that there was a syntax error on the syntax command (or some other parsing command). And in my Stata 16.1 installation, a missing which returns rc 111.
    Code:
    . capture noisily which gnxl
    command gnxl not found as either built-in or ado-file
    
    . display _rc
    111
    And for you too it printed the "invalid syntax" message associated with rc 197 and then reported rc 111 on exit.
    Code:
    help rc 111
    help rc 197
    Let me add that I have the same experience with the 1.5.1 version of matchit, so it is a pre-existing condition.
    Code:
    . capture noisily which matchit
    /Users/lisowskiw/Library/Application Support/Stata/ado/plus/m/matchit.ado
    *! 1.5.1 J.D. Raffo April 2019
    
    . capture noisily which freqindex
    command freqindex not found as either built-in or ado-file
    
    . matchit idmaster cnms using `myusing', idusing(idusing) txtusing(cnms) di sim(token)
    freqindex not found.
    matchit requires freqindex to be installed. You can get it in SSC.
    invalid syntax
    r(111);
    I am beginning to wonder if there is a problem in the built-in which command, or else with the capture prefix. As I initially experienced, the two message about freqindex were suppressed in my output. Yet now I too get those messages. And my first attempt just at the code immediately above suppressed the output from the which matchit command. But a second attempt a few minutes later produced what's above.

    This may be a problem worth seeking advice about from Stata Technical Services.

    Meanwhile, if Chris Jiao does not confirm my hypothesis about freqindex being missing, we still have to discover the source of the original problem. But I'm optimistic that the two are somehow related.

    Comment


    • #17
      Thanks William Lisowski and Julio Raffo for your updates.

      I double check with my code. Here is what I find.

      1. The error r(197) can be resolved by restarting Stata.

      2. I have installed both matchit and freqindex via code
      Code:
      ssc install freqindex
      and
      Code:
      ssc install matchit
      . However, when I run diagnose, I still cannot have the analyzing result (list of most frequent grams in master and using file). But actually, as I said previously, I can run the following code to have frequent grams in another way.

      Code:
      local myN=_N
      preserve
      freqindex cnms, sim(ngram, 3)
      gen share=freq/`myN'
      gsort -freq
      list in 1/20
      restore
      So I suppose it is not the problem of not installing freqindex. I speculate that it is one specific problem in my device?

      Comment


      • #18
        Dear both,

        Chris Jiao I think matchit is not yet updated in SSC (I've sent to them only yesterday). so that's why you're still getting the same results. If you cannot wait, you can install manually or from from Github by using the command github (by E. F. Haghish) that is in SSC:

        Code:
        github install julioraffo/matchit
        which matchit
        Check that version is 1.5.2 from May 2020, after using the which command. This should fix the issue.

        William Lisowski, thanks a lot for the debugging assistance. Clearly I'm doing something wrong with the interaction between capture and error commands. And, yes, I'm pretty sure this bug exists since I put that condition a long time ago. However, it is an innocuous bug as matchit is supposed to stop if freqindex is not found and the messages seem to display (at least in Stata 12, 13, 14 & 15, not sure in 16). The fact that it shows the wrong code is not great and I'll fix it for a following patch.

        Comment


        • #19
          Originally posted by Julio Raffo View Post
          Dear both,

          Chris Jiao I think matchit is not yet updated in SSC (I've sent to them only yesterday). so that's why you're still getting the same results. If you cannot wait, you can install manually or from from Github by using the command github (by E. F. Haghish) that is in SSC:

          Code:
          github install julioraffo/matchit
          which matchit
          Check that version is 1.5.2 from May 2020, after using the which command. This should fix the issue.

          William Lisowski, thanks a lot for the debugging assistance. Clearly I'm doing something wrong with the interaction between capture and error commands. And, yes, I'm pretty sure this bug exists since I put that condition a long time ago. However, it is an innocuous bug as matchit is supposed to stop if freqindex is not found and the messages seem to display (at least in Stata 12, 13, 14 & 15, not sure in 16). The fact that it shows the wrong code is not great and I'll fix it for a following patch.
          small correction, it seems that the github command is not in SSC (apologies for the mistake), but actually at Github: https://github.com/haghish/github#2-...-github-module. You can install it directly from Stata by running:
          Code:
          net install github, from("https://haghish.github.io/github/")

          Comment


          • #20
            First, my thanks for the pointer to the github command.

            I can now confirm that after uninstalling matchit and freqindex, then relaunching Stata, then installing matchit from github, the error message now was consistent with the return code.
            Code:
            . matchit idmaster cnms using `myusing', idusing(idusing) txtusing(cnms) di sim(token)
            command freqindex not found.
            matchit requires freqindex to be installed. You can get it in SSC or Github.
            r(162);
            And after installing freqindex from github, the sample code from post #13 ran as expected, with complete output.

            The versions of the two commands at this moment are
            Code:
            . which freqindex
            /Users/lisowskiw/Library/Application Support/Stata/ado/plus/f/freqindex.ado
            *! 1.3.2 J.D. Raffo April 2019
            
            . which matchit
            /Users/lisowskiw/Library/Application Support/Stata/ado/plus/m/matchit.ado
            *! 1.5.3 J.D. Raffo May 2020
            Last edited by William Lisowski; 20 May 2020, 11:29.

            Comment


            • #21
              Hi Julio, @Julio Raffo & Chris Jiao
              I have issue in the below code for some reason it doesn't find id1?? Do you have any advice? Thank you for help.

              ************************************************** ******************************
              use PPP_dataset, clear
              sort businessname
              duplicates drop businessname, force
              g id1 = _n
              save PPP_dataset_clean.dta, replace
              ************************************************** ********************************
              use Lobbyview_dataset_Client_Name.dta
              rename Client_Name businessname
              sort businessname
              *drop if businessname == businessname [_n-1
              g id2 = _n
              keep businessname id2

              **reclink
              ssc install reclink
              reclink businessname using PPP_dataset_clean.dta, gen(myscore) idm(id1) idusing(id2)

              Comment


              • #22
                The output of help reclink tells us about the idmaster() and idusing() options:
                Code:
                    idmaster(varname) is required and specifies the name of a variable in the master
                    dataset that uniquely identifies the observations.  This variable is used to track
                    observations.  If a unique identifer does not exist, one can be created simply as
                    gen idmaster=_n.
                
                    idusing(varname) is required and specifies the name of a variable in the using
                    dataset that uniquely identifies the observations analogous to idmaster.
                Since your code has
                Code:
                reclink businessname using PPP_dataset_clean.dta, gen(myscore) idm(id1) idusing(id2)
                idusing must be the id variable in PPP_dataset_clean.dta - id1- and idm must be id variable in the dataset in memory - id2 - so your reclink command should be
                Code:
                reclink businessname using PPP_dataset_clean.dta, gen(myscore) idm(id2) idusing(id1)

                Comment

                Working...
                X