Announcement

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

  • Error Using the Command 'using'

    Hello everyone,

    I just downloaded data from PSID. Every time I run the do.file that comes with the data, I get an error.
    The error occurs on the following line:
    Code:
    using "/Users/Desktop/PSID/Compiled"\J266327.txt, clear
    I appreciate any help on how to solve the issue.

    Best,
    Hussain Hadah

  • #2
    Welcome to Statalist.

    I am famliar with the PSID. Here is a sample of the important parts of a do-file simiar to yours.
    Code:
    #delimit ;
    
    infix
          ER30000              1 - 1           ER30001              2 - 5           ER30002              6 - 8    
          ER32000              9 - 9           ER32006             10 - 10          ER17001             11 - 11    
    using [path]\J999999.txt, clear
    ;
    So first you need to review the output of help #delimit to understand that the first command tells Stata that subsequent commands can continue over multiple lines, with a semicolon signalling the end of the command.

    So we now understand that your command is not using - it is infix, and using is part of the command that tells infix where to find the input file.

    The problem you have is that the quotation marks must surround the entire filename, not just the path to the directory the file is in. And use the forward slash rather than the backslash to separate the directory name from the file name. That way Stata will do the right thing, no matter which operating system you are on.
    Code:
    using "/Users/Desktop/PSID/Compiled/J266327.txt", clear
    Last edited by William Lisowski; 27 Oct 2019, 16:45.

    Comment


    • #3
      Thank you so much, William!

      Comment


      • #4
        I encountered the same problem using State 18.

        I've tried William's code, but I get

        command using is unrecognized
        r(199);

        Many thanks in advance for your help!

        Comment


        • #5
          you don't show us enough to point out the problem but note that there is no command "using" in Stata; if you look again at #1, you will see that the OP's command is "infix" and that "using" is part of that command - what command are you attempting to use?

          Comment


          • #6
            just like the code in #2, my do file starts with
            Code:
            #delimit ;
            infix
            Before I run it, I believe I have changed directory properly
            Code:
            cd /Users/yvonnedeng/Downloads/413/fam2021er
            do "/Users/yvonnedeng/Downloads/413/fam2021er/FAM2021ER.do"
            
            .
            . #delimit ;
            infix
            ...
            using [path]\FAM2021ER.txt, clear 
            > ;
            file [path]\FAM2021ER.txt not found
            Thank you for your reply, Rich!

            Comment

            Working...
            X