Announcement

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

  • Stata 16 - Drop just variables and observations

    I had Stata 14 and used drop _all command to drop just the variables/observations but keep all the return list from previous command and labels.
    Now I got Stata 16 and it seems drop _all is clearing up return list from previous commands. I used clear but it clears up labels and local macros.
    How can I attain the similar functionality of drop _all from Stata 14 in Stata 16?

  • #2
    Code:
    version 14: drop _all
    Which you can put in an ado file to reduce typing if you use it often.

    Comment


    • #3
      I appreciate your response but I wish to know if there is any equivalent way to do this is Stata 16 without using version 14.

      Comment


      • #4
        Jean-Claude Arbaut is giving you syntax for use in Stata 16. version is a command: see its help.

        Comment


        • #5
          I know but I think i am not clear with my question.
          I don't want to use version 14 command. Is there any other way available?
          Thanks.

          Comment


          • #6
            Is there any other way available?
            Actually, yes, but none that I would recommend, and certainly none that is simpler than -version-. Since Stata 15, the documentation of -drop- states that:

            Stored results

            drop and keep store the following in r():

            Scalars r(N_drop) number of observations dropped r(k_drop) number of variables dropped
            This means that the preceding r() return list is lost. If you have something useful in it, maybe you should just store it somewhere (local macro, scalar or matrix).

            The change was made in Stata 15.1, See -help whatsnew15-

            2. In Stata 15.1, drop and keep were modified under version control to store the number of
            observations dropped in r(N_drop) and the number of variables dropped in r(k_drop). However,
            they cleared previously set r() results too soon, meaning that an r() result passed to an if
            condition on drop or keep was treated as missing. This has been fixed.

            But I'm really curious: why would you want to avoid calling -version-? Note that many Stata commands use version control, there is nothing wrong with it. For instance -manova- starts with -version 11-. If you want to see some really old syntax, try -viewsource emdef.ado-. This command is called by _crcbygr, which in turn is used by svyprop. Note also that the previous paragraph from whatsnew15 implicitly suggests to use version control to revert to the previous behavior.
            Last edited by Jean-Claude Arbaut; 23 Jul 2019, 12:58.

            Comment


            • #7
              Thanks everyone!

              Comment

              Working...
              X