Announcement

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

  • Problem with running a DO file in STATA SE 16 for Mac IOS

    Dear colleagues,
    I want your help please,
    I received a Do file from windows STATA version, and i am trying to change the file location to run the DO file, but always i am receiving the following message:
    ​​​​​​. do "/var/folders/4g/ynfywdfn2vxbrm13s3v1slm00000
    > gn/T//SD00339.000000"

    . cd "Macintosh HD⁩\Users⁩\hasanainshukur⁩\Desktop
    > ⁩\PWS AND SLEEP⁩\sleep analysis⁩⁩"
    unable to change to Macintosh HD⁩\Users⁩\hasanains
    > hukur⁩\Desktop⁩\PWS AND SLEEP⁩\sleep analysis⁩⁩
    r(170);

    end of do-file

    r(170);
    Can you please help me?

    Best wishes.
    Hasanain.
    Last edited by Hasanain Shukur; 09 Jul 2020, 05:30.

  • #2
    On macOS and linux, path names use "/" as separators, not "" as Windows does.
    Code:
    . cd "\Users\lisowskiw"
    unable to change to \Users\lisowskiw
    r(170);
    
    . cd "/Users/lisowskiw"
    /Users/lisowskiw
    For your case, try
    Code:
    cd "/Users⁩/hasanainshukur⁩/Desktop/PWS AND SLEEP⁩/sleep analysis⁩⁩"

    Comment


    • #3
      Hi William!
      Thanks for you kind replay, I applied the above code, and i got the following:

      ​​​​​​ cd "/Users⁩/hasanainshukur⁩/Desktop/PWS AND SLEEP⁩/sleep analysis⁩⁩" clear
      invalid syntax
      r(198);
      Thanks again for the cooperation.

      Comment


      • #4
        "clear" does not belong on the cd command, take it off.

        Comment


        • #5
          Dear William,
          Thanks for the quick replay, but i still need your help, if possible.
          I tried many things, i till now i am receiving the same message.
          lastly, i tried to change the file location and put it on the desktop, and changed the excel file name, but still have the same error 170 message:

          cd "/Users/⁩hasanainshukur⁩/Desktop⁩⁩"

          import excel "PWSFINAL.xlsx", sheet("Ark1") firstrow

          The results always like this:

          . do "/var/folders/4g/ynfywdfn2vxbrm13s3v1slm00000gn/T//SD92
          > 906.000000"

          . cd "/Users/⁩hasanainshukur⁩/Desktop⁩⁩"
          unable to change to /Users/⁩hasanainshukur⁩/Desktop⁩⁩
          r(170);

          end of do-file

          r(170);
          Please, any solution?

          Comment


          • #6
            Run the following Stata commands
            Code:
            cd
            cd Desktop
            and then report the results to us. This is what happens for me.
            Code:
             cd
            /Users/lisowskiw
            
            . cd Desktop
            /Users/lisowskiw/Desktop

            Comment


            • #7
              Dear William,
              Thanks for you efforts.
              I did it exactly the same as your example, but the STATA gave me ( is not a valid command name r(199), and when i put the sign" before and after the commands, it gave me (unable to change to /Users/⁩hasanainshukur, r(170)


              Comment


              • #8
                Please type the first command
                Code:
                cd
                into Stata's Command window and run it, then type the second command
                Code:
                cd Downloads
                into Stata's Command window and run it, then in Stata's Results window copy the two commands and their output and paste that information into your next post, as you have done in your earlier posts. Don't tell us what you did and how Stata reacted, show us exactly.

                Comment


                • #9
                  Thanks!
                  I got the following:

                  . cd
                  /Users/hasanainshukur

                  . cd Downloads
                  /Users/hasanainshukur/Downloads

                  .

                  Comment


                  • #10
                    I am beginning to think that perhaps the do-file from Windows is the source of the problem, although I cannot tell why that would be. Please try the following.

                    In the Stata Do-file Editor window, open a new tab and type in the following - please type them, don't copy-and-paste because (rarely) the Statalist software causes extra invisible characters to be added to the post. This code assumes your renamed Excel file continues to be located on your Desktop.
                    Code:
                    cd
                    cd Desktop
                    import excel "PWSFINAL.xlsx", sheet("Ark1") firstrow
                    Again, if this doesn't work, copy-and-paste lines from Stata's Results window into a new post.

                    If that does work, then I conclude that the problem is somehow with the Windows do-file you have been editing and using. I've not see this before - Stata for macOS can run do-files from Stata for Windows just fine, Stata handles the different line-end sequence correctly. Did you open the do-file in Stata's Do-file Editor window, or did you open it in some other editor and copy-and-paste lines into the Do-file Editor window?


                    Comment


                    • #11
                      Dear William,
                      It worked finally!
                      Thanks a lot for your support. i added your code and this time i write it without copy and paste. and it worked.
                      Best wishes.
                      Hasanain.

                      Comment


                      • #12
                        Hi William!
                        I have an issue with the do file, can you help me please?
                        It works now, but when i give the order:
                        ​​​​​​ table group, c(mean BMI sd BMI mean age sd age) format(%9.2f) center row col
                        I then receive the following:
                        variable group not found
                        r(111);

                        It was working before, and gave me the assigned table.
                        thanks.

                        Comment


                        • #13
                          When you say "it was working before" I assume you mean it worked at some time after you solved the original problem with the do-file not working correctly, and it now no longer works.

                          This is a different problem and should be posted as a new topic on Statalist, so that it gets attention from members who have not followed this topic because they had nothing to contribute to the original problem.

                          Before starting your new topic, please 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], and to use the dataex command to provide sample data, as described in section 12 of the FAQ.

                          Without having seen your code, how is it possible for us to comment on what problems it may have?

                          The more you help others understand your problem, the more likely others are to be able to help you solve your problem.
                          Last edited by William Lisowski; 20 Jul 2020, 10:13.

                          Comment

                          Working...
                          X