Announcement

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

  • The "replace" option to the table command in Stata 16 is on longer available in Stata17; is there an alternative in Stata 17?

    In Stata 16 you could code:
    table ..., replace
    to replace the data in memory with the results produced by the table command.

    Is there an alternative in Stata 17, or a way to convert results from a collection to data?

    Regards Kim

  • #2
    Maybe version control.


    .ÿquietlyÿsysuseÿauto

    .ÿversionÿ16.1:ÿtableÿforeign,ÿcontents(meanÿpriceÿsdÿprice)ÿreplace

    ------------------------------------
    Carÿÿÿÿÿÿÿ|
    originÿÿÿÿ|ÿmean(price)ÿÿÿÿsd(price)
    ----------+-------------------------
    ÿDomesticÿ|ÿÿÿÿÿ6,072.4ÿÿÿÿÿ3097.104
    ÿÿForeignÿ|ÿÿÿÿÿ6,384.7ÿÿÿÿÿ2621.915
    ------------------------------------

    .ÿlist,ÿnoobs

    ÿÿ+-------------------------------+
    ÿÿ|ÿÿforeignÿÿÿÿtable1ÿÿÿÿÿtable2ÿ|
    ÿÿ|-------------------------------|
    ÿÿ|ÿDomesticÿÿÿ6,072.4ÿÿÿ3097.104ÿ|
    ÿÿ|ÿÿForeignÿÿÿ6,384.7ÿÿÿ2621.915ÿ|
    ÿÿ+-------------------------------+

    .


    Code:
    help version
    for more information.

    Comment


    • #3
      Yes, version control does it, but I would prefer a Stata 17 solution, preferable a way to convert a "collection" of results to data!

      Comment


      • #4
        I'm not sure what would qualify as a Stata 17 way to do it. StataCorp redesigned the -table- command with the introduction of -collect- and left the predecessor around under version control. That's a perfectly valid approach, and it's a reason why done functionality is preserved under version control.

        Otherwise, you can achieve the same example result with -collapse- or -tabstat- (etc), which have existed since well before Stata 17. Would that meet your qualifications?

        At the the end of the day, the code is clean and functional. Maybe in future, StataCorp will add the ability to return data from -table- (or rather what is shown by -collect preview-) as a dataset, but it doesn't yet exist.

        Comment

        Working...
        X