Announcement

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

  • Error message "invalid 'Drive'" when using spwmatrix

    Hi all,

    I am trying to import a Geoda-generated .gal file into Stata and export it as a .txt file. I have tried writing the syntax every which way, and read every search result I can find, but I keep getting the error message "invalid 'Drive'". Any ideas what I'm doing wrong? The code that generated the error is below. I'm using Stata 13. Thanks!

    Code:
    spwmatrix import using "/Users/brendenbeck/.../Queens 1st, all years.gal", wname(weights) xport(weights, txt)

  • #2
    I don't think that's precisely the code you used, unless you actually have a directory named "..." along the path from your home directory to the file.

    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].

    Section 12.1 is particularly pertinent

    12.1 What to say about your commands and your problem

    Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
    With that said, you might break the problem in two and omit the xport option and see if the problem persists. If so, then my first guess is that there is something wrong with the contents of the .gal file. Do you have other .gal files - preferably from a different source - that you can test with?

    Added in edit: Searching the web suggests that at some point the format of GeoDa .gal file headers changed. Since the user-written spwmatrix command was last updated at SSC five years ago, perhaps it does not support the newer format. You might contact the author of the software.
    Last edited by William Lisowski; 04 Mar 2019, 18:14.

    Comment


    • #3
      In post #1 you showed the necessary quotation marks around your file path, which post #4 omits, and additionally shows us the path contains an embedded space between "Google" and "Drive" that was not shown in post #1. Stata thinks the "using" file ends at "/Google" and doesn't know what to make of "Drive". The key is to notice that the error message includes "Drive" and your code includes "Drive".

      Surround your file path with quotation marks and try again.
      Code:
      spwmatrix import using "/Users/brendenbeck/Google Drive/Research & Writing/Analysis Resources/XSMLE Tutorial/Weights_file.gal", wname(weights)
      Last edited by William Lisowski; 06 Mar 2019, 07:54.

      Comment


      • #4
        My guess is that spwmatrix is implicitly assuming within the program that your filepath and name have no spaces. A test of this would be to navigate to the directory or folder containing your file, or a copy of it. Another test is to

        Code:
        set trace on
        and see where the code complains.

        After all your code in #1 did show a filename within "" and yet you reported a problem.

        Comment


        • #5
          Nick's guess is good - I've reproduced the problem on my system.
          Code:
          . spwmatrix import using "/Users/lisowskiw/Desktop/problem data/Weights_file.gal", wname(weights)
          invalid 'data' 
          r(198);
          The offending code fragment in spwmatrix.ado is
          Code:
                  local using "`s(using)'"
          ...
                  if "`using'"=="" {
          ...
                  }
                  else {
                          DisplayReport using `using', ...
                  }
          where the DisplayReport command does not surround `using' in quotation marks as the if command had done.

          I've sent an email off to the address for the author recorded in ssc describe spwmatrix.

          Comment

          Working...
          X