Announcement

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

  • Why are Frames Useful

    Perhaps this is a question for another forum, but I had a more general question about dataframes.

    I know the data frame feature was added in Stata (16?). Me personally, I'm old school. I started using Stata (semi-seriously) in my (senior?) year of college, with Stata 15, and now as a 1st semester Ph.D student with Stata 17. Thus, when data frames were added to Stata, I didn't know what they were or why I'd need them.

    I know Python and R use dataframes, and I get the basic concept behind them... but all the same, why are they useful? Why would I (or anyone) want to use them, ever? I never got the jazz behind storing multiple datasets into n frames at once. Could anyone a little more.... enlightened, than me talk a little about why people should/would want to use dataframes for serious applied work such that it makes life remarkably easier than Stata pre-data frames?

    It isn't that I dislike them or think they're bad, I've just never been in a situation where I thought to myself "Gee, another dataset sure would come in handy right about now." Anyone have any thoughts about this?

  • #2
    I think Stata Corp did not want to be left behind R and Python, so it added frames. Things done with frames were previously done with preserve / restore, or temporary files, etc. I think frames make such tasks easier now. I do not use frames because it creates a backward compatibility issue, so I still rely on preserve/restore or saving temporary datasets to disk.
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

    Comment


    • #3
      Here are the views of a once upon a time sceptic: https://blog.stata.com/2019/09/06/fun-with-frames/

      Comment


      • #4
        why are they useful?
        In memory dataframes are faster than files. Even if you do not use the frames commands in your code, some commands you use written by others, including StataCorp, will be faster due to frames. Also, see manual [D] frames intro — Introduction to frames. What frames can do for you.

        Comment


        • #5
          Another way in which I have found frames useful is when a large series of commands is to be carried out on a proper subset of the data. Instead of attaching an -if- qualifier to each of those commands (which is tedious and error-prone to code, and also slows down execution considerably) I -frame put ... if ..., into(another_frame)-, and then have the commands execute in that other frame. Then I bring the results back to the original frame with -frlink- and -frget- or -frval()-, or by dropping the original observations from the original frame and appending another_frame to it. (See Jeremy Freese's -frameappend- from SSC). In large data sets this can save an enormous amount of run time.

          Comment


          • #6
            I personally find useful frames when I need to generate my final dataset out of multiple ones. In the past i was using preserve/restore or opening multiple stata windows. Now, i do all the job from the same stata page using frlink and frget as well

            Comment


            • #7
              Originally posted by Andrew Musau View Post
              Here are the views of a once upon a time sceptic: https://blog.stata.com/2019/09/06/fun-with-frames/
              I find frames very useful to manage postestimation results. I made use of that in my kinkyreg package.
              https://www.kripfganz.de/stata/

              Comment

              Working...
              X