Announcement

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

  • Copy/pasted code made Stata think I'm using a Mata programming command!

    Halp! I copied and pasted some code from a colleague without realizing it might have embedded programming. I don't use Mata or LaTeX and I'm not even sure how they integrate with Stata. The sad thing is that once I started having this error message, even though I thought I stripped the code by (1) copying and pasting it into Notepad, removing the commands I didn't want (e.g., {tex} commands and pasting it into a clean do-file and then (2) installing and using texdoc to supposedly strip the file and replace it with one that doesn't have tex commands, I'm still getting the following error:

    unrecognized command: lstrfun
    r(199);

    Finally I tried installing lstrfun (which was part of the dofile I copied and pasted from), and when I ran the file this time, when it got to the copied and pasted part it started trying to encode all the string variables in the dataset and ended with invalid syntax:

    *run LCAs using runmplus
    .
    . foreach pony in 1 2 3 4 5 6 7 {
    runmplus `aicasvars', ///
    > variable(categorical=`aicasvars'; classes=q(`pony'); ///
    > cluster is class; idvariable=ID
    analysis(type=complex mixture; proc=8;starts=100 20 ///
    > output(tech10; tech11; svalues; ) ///
    > savelogfile(eulcaV6`pony') ///
    > saveinputdatafile(eulcaV6`pony') ///
    > saveinputfile(eulcaV6`pony')
    }
    encoding Id
    encoding Q21b
    encoding Q21c
    encoding Q36c
    ...

    I should mention that this is also after a bunch of restarts and making sure I didn't accidentally turn on Mata (had to look up to see what that was).

    OK I tried one more thing--deleting all the spaces between lines and characters (aside from the commands themselves) and running and I got a little further, but I still think there's hidden code, because now I got " unrecognized command: strparse"

    Unless you all have some good ideas, I think I will just try uninstalling and reinstalling Stata. But it would be good to know what's going on.

    And yes, I will try to learn LaTeX; just not to that point yet.

    Thanks!

    Michelle
    Last edited by Michelle Carras; 28 Nov 2015, 07:43. Reason: Added tags

  • #2
    Hi Michelle
    I don't think you have to reinstall Stata.
    And I don't think it has anything to do with either Mata or LaTeX.

    What I do think is that you if possible should go back to your colleague and ask him/her for help and a proper explanation.
    Kind regards

    nhb

    Comment


    • #3
      strparse (SSC) is a user-written command. As of Stata 8 (2005) it has been superseded by split. You could re-write the strparse call to use split or install the strparse command using

      Code:
      ssc inst strparse
      (This is why we have archives!)

      As Niels advises, there absolutely no need to reinstall Stata on this evidence.

      The problem seems to lie entirely in poor documentation of the do-file, but many users lose track of which commands are official and which user-written (and so need to be installed).
      Last edited by Nick Cox; 30 Nov 2015, 04:03.

      Comment

      Working...
      X