Announcement

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

  • Eliminate not used variables

    Is there a quick way to eliminate from the dataset any variable that I do not use in the do file?

  • #2
    FLuca:
    see -drop-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Carlo Lazzaro is right but knowing which variables you do use in the do-file is the big deal here. That is anywhere between trivial (you just know or can quickly scan a short file) and very difficult (there can be a great deal of text in a do-file).

      Comment


      • #4
        Nick is right.
        Note for myself: easy replies to potentially difficult questions are never fully on target!
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          I guess the answer No would be unwelcome, although not the shortest answer ever on Statalist, one character long, which has been seen at least once. That answer was

          C

          and the question was ....

          (Not answering at all is trivial here.)

          Comment


          • #6
            Unfortunately, it is a very long do file, that works on a very large dataset, where some variables have similar names.
            So, I wanted to reduce the dataset to the parts of it that I am using, while avoiding to drop variables that I am indeed using.
            I thought that perhaps Stata retained somewhere the information on used variables (e.g., I open a new Stata session, I open the do file, run it all at once, and Stata knows what I have used and stores somewhere this information).
            Asides from avoiding mistakes, it would allow me to save lots of time.
            Thanks anyway!
            Last edited by FLuca; 14 Apr 2022, 08:38.

            Comment

            Working...
            X