Announcement

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

  • Cannot Load Files for Table of Graphs Due to r(170) error

    Hello all:

    I am attempting to create a table of graphs, but I am having issues loading the files within the current directory. I am using a Mac with Stata 15,

    Following from Google advice, I first typed

    cd "/Users/greghawrelak/Documents/Dissertation! "

    Which then gives me this:

    /Users/greghawrelak/Documents/Dissertation!

    It does not provide me any error messages, and the working directory when I type pwd is:

    /Users/greghawrelak/Documents/Dissertation!

    This tells me that the working directory should be set correctly.

    As per my issue, I have three graphs I am trying to merge into a table of graphs. However, when I type this code,

    graph combine "/Users/greghawrelak/Documents/Dissertation! /Omnibus 2020_DemCon:Dem False.gph" "/Users/greghawrelak/Documents/Dissertation! /Omnibus2020_DemCon:Dem Possibly True.gph" "/Users/greghawrelak/Documents/Dissertation! /Omnibus2020_DemCon:Dem DefinitelyTrue.gph"

    It provides me with this error output:

    could not change to directory /Users/greghawrelak/Documents/Dissertation!
    chdir(): 170 could not change directory
    __pathmkabsolute(): - function returned error
    __filemkabsolute(): - function returned error
    <istmt>: - function returned error

    My confusion is why this is happening given that my working directory appears to be set correctly. I do not have a very detailed programming knowledge, so any clarification anyone can provide is appreciated!




  • #2
    The last forward slash in the second and third graph filenames imply that Stata should look in a subdirectory. -- which in your case doesn't exist.

    As you are already in the directory of interest, it seems that


    Code:
    graph combine "Omnibus 2020_DemCon:Dem False.gph" "Omnibus2020_DemCon:Dem Possibly True.gph" "Omnibus2020_DemCon:Dem DefinitelyTrue.gph"
    is what you want.

    As someone who started before any OS I used allowed spaces in directory or filenames, I still avoid them. But that isn't the issue here, I guess. It's the slashes.

    Comment


    • #3
      Thank you, Nick, for the clarification. I entered the code as you have it, and the error code has changed from r(170) to r(601) file not found, which is quite baffling since I can visibly see it within the directory I have set on my Mac.

      EDIT: I thought I had the same naming convention across all graph files, but I evidently had changed the spacing in one file name. Renaming it to the correct convention and using the provided advice fixed the problem. Many thanks!
      Last edited by Greg Hawrelak; 26 Jun 2021, 06:50.

      Comment


      • #4
        As a Mac user, let me add that colons are disallowed in file names on the Mac. Back in the day (pre macOS, pre OS X, I'm talking System 9 and earlier) colons were used as directory separators in the Mac filesystem paths.

        If you use a standard macOS Save dialog box (e.g. from Stata's File > Save menu or by clicking the Save button in the Graph window) and try to save a file with a colon in the name, when you type the colon it is replaced as you type it with a hyphen: a standard feature of this macOS-supplied dialog box.

        If you us a save or graph save command in Stata's command window and include a colon in the name, Stata replaces the colon with a slash.This is confusing, but backwards compatible for Do-files written in the Neolithic era of Macintosh computing.

        Comment

        Working...
        X