Announcement

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

  • Changing order paths

    Hello,

    I am currently writing my master's thesis and did save all my codes on my computer. However, when I hand in my code to my supervisor, the order paths will not work anymore, given that they all start similar to this
    HTML Code:
    "C:\Users\Tim\Desktop etc.
    Is there a way to work around this problem or does my supervisor have to change all order paths according to his computer?

    Any help is much appreciated

    Thank you very much

  • #2
    You know the answer to this really! Whatever code is specific to your computer won't work on anyone else's. If your code is one or more do-files, it's a text editor job.

    Comment


    • #3
      So my supervisor has to change all order paths manually according to his computer? Since I do not even know which computer system he uses I guess I can't do anything about it.

      Sorry if it appeared to be a stupid question. Thanks for your help

      Comment


      • #4
        It's not a stupid question, just one that is hard to answer well without much detail.

        For example: What form is your code? Is it just do files or did you write any programs in ado files? Where in your code do you refer specifically to directories or folders? Usually that is just in import or export of files, but if you are running do files located in one directory within another then you will need to say where they are. Did you at any point in your code cd from one directory to another?

        Two other dimensions which are completely open:

        What are the expectations for reproducibility at your institution? Aren't there instructions on this? (We should not come between you and your institution: see FAQ Advice extras on assignments.)

        Your operating system and how you edit files, whether within Stata or outside it using a text editor and/or scripting language (or even a word processor, although I wouldn't recommend that at all).



        Comment


        • #5
          I think you could do something like this - where the paths would just need to be specified once at the top of the code

          Code:
          // dis c(username) will display the ID reported by the operating system
          if c(username) == "Tim" {
              cd "C:\Users\Tim\Desktop\Research"
              local path "C:\Users\Tim\Desktop\Research"
              local graphs "`path'/Graphs"
              local output "`path'/Output"
              }
          else {
              cd "C:\Users\ProfSmith\MastersStudents\Stuff_to_Ignore/"
              local path "C:\Users\ProfSmith\MastersStudents\Stuff_to_Ignore/"
              local graphs "`path'/Graphs"
              local output "`path'/Output"
          }
          
          //Run rest of code
          sysuse auto
          scatter price mpg
          graph export `graphs'/CoolGraph.svg, replace

          Comment

          Working...
          X