Announcement

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

  • Bugs when using multiple Stata sessions on Mac OS

    Hi all,
    I have recently switched from Windows to MacOS (M3 Air), and encountered a strange bug when running multiple sessions of Stata on my machine. Specifically, Stata automatically rounds all decimal numbers integers, for example 0.5 is interpreted as 0, but only when I run Stata as a multiple session. Here's the details.

    Stata version: 17 SE
    Mac version: Sonoma 14.4

    If I open StataSE.app and write the following:

    set obs 10
    gen float x = 0.5
    tab x

    It correctly shows 10 instances of the value 0.5.

    If I then open another Stata session using the following line in terminal:

    open -n /Applications/Stata/StataSE.app

    And then do the exact same thing, x has the value of 0 for all observations. It also claims that e.g. 0.5*0.5 is equal to zero. This is not a formatting issue (I've tried reformatting the variable to e.g. 9.2f). A possible hint is that setting format to 9.2f shows the number 1/2 (which works as intended) as 0,5, with a comma. This is despite having run "set dp period, permanently" before. Generating x = 0,5 with a comma does not work (gives error message "option 5 not allowed").

    Does anybody know why this might occur, and how to fix it? I find it very valueable to be able to run multiple Stata sessions on Mac.

    Best,
    Petter

  • #2
    I do this differently; I go finder and copy the app file so that I have more than one version of it and can easily have more than one open at a time with nothing like this happening; I, in fact, have 4 copies of the app file and have sometimes had all 4 open at once; I have never tried it the way you are doing and have no idea why you are seeing the results you see

    Comment


    • #3
      Originally posted by Rich Goldstein View Post
      I do this differently; I go finder and copy the app file so that I have more than one version of it and can easily have more than one open at a time with nothing like this happening; I, in fact, have 4 copies of the app file and have sometimes had all 4 open at once; I have never tried it the way you are doing and have no idea why you are seeing the results you see
      Thank you Rich, I tried what you suggested, and this seems to work. Also updated to Stata 18, and the problem running another session from the terminal is still an issue there.

      I like being able to run a script quickly to open a fresh session of the app (although your method works pretty much identically), so if anyone has any suggestion of how to write the terminal command such that this works (maybe something with admin privileges?), I'm happy for suggestions.

      Best,
      Petter

      Comment


      • #4
        Originally posted by Petter Berg View Post
        Hi all,
        If I then open another Stata session using the following line in terminal:

        open -n /Applications/Stata/StataSE.app
        This is a perfectly valid way to launch another instance of Stata and we do something very similar here. I was not able to reproduce your problem though. However, I do know that an application launched from the Finder and an application launched from a terminal will run with different environment variables. It's why simply adding an environment variable in your shell startup script is not picked up by a Stata launched from the Finder. I can't think of any environment variable that can cause what you're seeing but perhaps you should try launching Stata from the terminal with a clean environment (using env -i) to eliminate anything that may be in your shell startup script. For example,

        Code:
        $ env -i bash
        
        bash-3.2$ open -n /Applications/Stata/StataSE.app
        -Chinh Nguyen

        Comment

        Working...
        X