Announcement

Collapse
No announcement yet.
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    I have a very simple request: could you please add an option [, rsort] that does a reverse (ascending) sort on frequency as opposed to just the descending sort? Myself (and coworkers) get annoyed with constantly having to scroll up to see the most frequent tabulations when there are more than 20 or so values of a variable.

    Comment


    • #47
      Originally posted by Carl Isaac View Post
      I have a very simple request: could you please add an option [, rsort] that does a reverse (ascending) sort on frequency as opposed to just the descending sort? Myself (and coworkers) get annoyed with constantly having to scroll up to see the most frequent tabulations when there are more than 20 or so values of a variable.
      Sounds like a good suggestion. While waiting for it to be implemented, you might want to download and install Ben Jann's fre program. I usually prefer it over the tab1 command because of all the nice features and options it has. Example:

      Code:
      . webuse auto, clear
      (1978 automobile data)
      
      . tab1 rep78, sort
      
      -> tabulation of rep78  
      
           Repair |
      record 1978 |      Freq.     Percent        Cum.
      ------------+-----------------------------------
                3 |         30       43.48       43.48
                4 |         18       26.09       69.57
                5 |         11       15.94       85.51
                2 |          8       11.59       97.10
                1 |          2        2.90      100.00
      ------------+-----------------------------------
            Total |         69      100.00
      
      . fre rep78, descending
      
      rep78 -- Repair record 1978
      -----------------------------------------------------------
                    |      Freq.    Percent      Valid       Cum.
      --------------+--------------------------------------------
      Valid   3     |         30      40.54      43.48      43.48
              4     |         18      24.32      26.09      69.57
              5     |         11      14.86      15.94      85.51
              2     |          8      10.81      11.59      97.10
              1     |          2       2.70       2.90     100.00
              Total |         69      93.24     100.00           
      Missing .     |          5       6.76                      
      Total         |         74     100.00                      
      -----------------------------------------------------------
      
      . fre rep78, ascending
      
      rep78 -- Repair record 1978
      -----------------------------------------------------------
                    |      Freq.    Percent      Valid       Cum.
      --------------+--------------------------------------------
      Valid   1     |          2       2.70       2.90       2.90
              2     |          8      10.81      11.59      14.49
              5     |         11      14.86      15.94      30.43
              4     |         18      24.32      26.09      56.52
              3     |         30      40.54      43.48     100.00
              Total |         69      93.24     100.00           
      Missing .     |          5       6.76                      
      Total         |         74     100.00                      
      -----------------------------------------------------------
      
      .
      Type ssc describe fre for more info on the command.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://academicweb.nd.edu/~rwilliam/

      Comment


      • #48
        #46 is naturally a request to StataCorp but while you're waiting groups from the Stata Journal has an option order(high) / order(low) to control sort order.

        Code:
        . search st0496, entry
        
        Search of official help files, FAQs, Examples, and Stata Journals
        
        SJ-18-1 st0496_1  . . . . . . . . . . . . . . . . . Software update for groups
                (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
                Q1/18   SJ 18(1):291
                groups exited with an error message if weights were specified;
                this has been corrected
        
        SJ-17-3 st0496  . . . . .  Speaking Stata: Tables as lists: The groups command
                (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
                Q3/17   SJ 17(3):760--773
                presents command for listing group frequencies and percents and
                cumulations thereof; for various subsetting and ordering by
                frequencies, percents, and so on; for reordering of columns;
                and for saving tabulated data to new datasets
        As above the entry st0496 is an unpredictable shortcut to finding download linke, given the mischief of mine in using a common word for the name of the command. That is, a search using the word groups finds much more than you want here.

        Comment


        • #49
          A request to allow importing pdf text into Stata (doesnt have to be neatly imported). One of the many use cases is of importing a PDF questionnaire of Survey Solutions which can be handy to make a data set which indicates each variables enabling condition, along with page number, answer choices etc. for analysis purposes.

          Comment


          • #50
            Add an offset option in twoway bar command. This will solve overlap problem when several quantities are observed at the same distinct categories or a series of times. If twoway bar has same mechanism with graph bar, there will be no necessary for using transparency or opacity to make the overlap clear. (By the way, bargap() in graph bar and barwidth() in twoway bar are confusing every so often.)

            Overlaying twoway bar graphs - bars side-by-side not overlaid

            Changing a density figure to get bars side by side instead of overlaying one another

            side_histogram available from SSC

            Comment


            • #51
              Originally posted by Tommy Morgan View Post
              Allow/create a few fill patterns for graphs!
              Ironically, there was this in ancient times of Stata.

              How can I create a pie or bar chart containing categorical data?

              Click image for larger version

Name:	bar3.gif
Views:	1
Size:	24.9 KB
ID:	1780834

              Comment


              • #52
                Add an -append- option to -frame put- or create a -frame append- command, so that rows from one frame can be appended to another.

                In my work, it is common to construct a single data file from a large collection of files, selecting certain variables and rows from each of the primary files, and doing a bit of data preparation on them. As far as I can see, one still needs to do this but saving each primary file's distillation to a temp file, then appending to the secondary file being constructed. One cannot do it in the more modern -frame- idiom.

                Comment


                • #53
                  Some small things that would be of value to authors of .do and .ado programs:

                  1) Allow a -set tracedepth- value that traces within forvalues/foreach loops. Often I will have a long program that executes once for each year, sex,age, or state and traces are currently not very useful.

                  2) Add the target variable name to the "NN values changed" message from the -replace- statement. I will often hae a long list of replace statements in a loop, and there is no way to connect the message to the statement causing it.

                  3) Add a warning if the expression in an -if- command depends on the first observation of a variable. This isn't for me -I learned my lesson some decades ago- but it would help new users.

                  4) Add a -set idempotent on- that would add an impiicit -replace- option to statements that offered that, and made generate into replace as needed. See https://www.codementor.io/@sidverma3...nce-22zkyc7ci1 . I realize that Stata can't be 100% idempotent, but it could be perfect for the bulk of user code, especially if you don't worry about the log file being a problematic side effect.

                  Comment


                  • #54
                    Daniel Feenberg There already is a set tracedepth command.

                    set tracedepth specifies how many levels to descend in tracing nested programs. The default is 32000, which is equivalent to infinity.

                    Would you like it modified in some way? If so, could you give an example of what you have in mind?
                    -------------------------------------------
                    Richard Williams, Notre Dame Dept of Sociology
                    StataNow Version: 19.5 MP (2 processor)

                    EMAIL: [email protected]
                    WWW: https://academicweb.nd.edu/~rwilliam/

                    Comment


                    • #55
                      I believe this has been raised in earlier Wishlists—and it's certainly possible that I'm unaware of a solution—but it would be handy if something like a do-file that contained only Mata code could be executed (a) from the do-file editor and (b) interactively from within the Mata environment. Among other things this would be valuable in code development and debugging.

                      After execution the user would remain in the same Mata environment, modified only by the Mata operations in the executed file.

                      For example, from the do-file editor one might currently execute Mata code from the Stata environment using a do-file structured like:
                      Code:
                      mata
                      ... (mata code)
                      end
                      Instead one might have a domata file like this:
                      Code:
                      domata
                      ... (mata code)
                      domataend
                      If one executed this from the do-file editor while in the Mata environment domata and domataend would instruct Mata to remain in the Mata environment, execute the Mata code, and then remain in the Mata environment after execution.

                      Conversely if the same file was executed from the do-file editor while in the Stata environment domata would enter the Mata environment, execute the Mata code, and then domataend would return the user back to the Stata environment. In this case it would be as if domata and domataend acted identically to mata and end.

                      I realize that a solution like may be well beyond what's technically feasible and possibly—for reasons I may not be appreciating—actually undesirable.

                      Comment

                      Working...
                      X