Announcement

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

  • I cannot open a dta file with relative addressing

    I am a mac user and I work with Stata SE 18.0. I have opened a do file and want to read a dta file. I can open the file using the full address perfectly. I use this command:

    Code:
    use "/Users/homa/Downloads/data/WBES_FIRM/Angola/Angola-2010-full-data-.dta", clear

    Since this is a shared project, I want Stata to change the directory to a local folder first, then open the file. So my colleagues can execute the do file easily on their systems. I use these commands:

    Code:
    cd "/Users/homa/Downloads"
    use "../data/WBES_FIRM/Angola/Angola-2010-full-data-.dta", clear

    But these two commands cannot open the file, and report this error message: file ../folder/your_file_name.dta not found r(601);


    I would appreciate your help.
    Last edited by Homa Taheri; 08 May 2024, 10:40. Reason: I used the # option to write up the Stata codes.

  • #2
    The double dot "../" means the parent folder of your current directory. "./" means the current directory. You should be able to use
    Code:
    use "./data/WBES_FIRM/Angola/Angola-2010-full-data-.dta", clear
    or
    Code:
    use "data/WBES_FIRM/Angola/Angola-2010-full-data-.dta", clear

    Comment


    • #3
      The double dot "../" means the parent folder of your current directory. "./" means the current directory.
      Thank you so much! Yes, both codes worked.

      Comment

      Working...
      X