Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: re-sorting display order after -encode-


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: re-sorting display order after -encode-
Date   Tue, 11 Mar 2014 09:56:02 +0000

-groups- (SSC) can also show more than 50. Be careful of what you wish
for, as the result can be very unwieldy.

Moreover, -groups- extends to displays for more than one variable,
although always reshaped to a one-way table showing combinations of
values.

Nick
[email protected]

On 10 March 2014 22:25, Radwin, David <[email protected]> wrote:

> At risk of drifting somewhat the original topic, you might consider
> -fre- (Ben Jann, SSC) as an alternative for one-way frequencies. It
> shows up to 50 characters of value labels by default. You can specify
> more characters using the -width- option or let it wrap the labels.


Jeph Herrin

>> Apart from taking care with -encode-, I've long thought that the
>> workhorse -tab oneway- could offer some additional display options.
>> There is an option to sort on descending frequency, but this makes it
>> even more natural to include some other options, such as sorting on
>> value label.
>>
>> Would also be very nice if -tab- could be persuaded to display the
> full
>> width, or at least up to say 40 characters, of the value label.

On 3/10/2014 3:25 PM, Nick Cox wrote:

>> > There are some related comments in
>> >
>> > SJ-11-2 dm0057  . . . . . . . . .  Stata tip 99: Taking extra care
> with
>> encode
>> >          . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> C.
>> Schechter
>> >          Q2/11   SJ 11(2):321--322
> (no
>> commands)
>> >          tip on safely using encode across datasets
>> >
>> > That said, the fact that alphanumeric ordering almost always is not
>> > what you want with ordered scales could, I think, be flagged a
> little
>> > more prominently in the official documentation. Once you understand,
>> > it is obvious, but it deserves a short comment.

On 10 March 2014 19:09, Michael McCulloch
:
>> >> Thanks Nick!

On Mar 10, 2014, at 1:26 AM, Nick Cox wrote:

>> >>> You evidently just used the default produced by -encode- so that
>> >>> incoming strings were labelled according to their alphanumeric
> order.
>> >>> Thus values 1, 2, 3, 4, 5  correspond to strings "0-200" ...
>> >>> "501-1,000". -encode- has no notion of looking inside the strings
> to
>> >>> discern a meaning and thus a natural order, any more than than it
> can
>> >>> sort "average" "bad" "good" into the correct order. You need to
> define
>> >>> labels in advance before you use -encode- or fix the problem using
>> >>> -recode- or some equivalent.

On 10 March 2014 03:01, Michael McCulloch

>> >>>> I have used -encode- to add value labels from string variable,
> which
>> are a series of numerical ranges stored as text.
>> >>>>
>> >>>> -codebook- shows the frequency data, and Label values, were
> correct.
>> >>>> Freq.                   Numeric         Label
>> >>>> 121             1                       0-20
>> >>>> 16                      2                       1,001+
>> >>>> 36                      3                       101-500
>> >>>> 81                      4                       21-100
>> >>>> 8                       5                       501-1,000
>> >>>>
>> >>>> However, I wish to display them using -tab- so that the rows are
>> sorted on the value label.
>> >>>> The -encode- help file does not suggest this is possible. Is
> there a
>> workaround?
>> >>>>
>> >>>> What I want to achieve is -tab- showing this:
>> >>>> Label                   Freq
>> >>>> 0-20                    121
>> >>>> 21-100                  81
>> >>>> 101-500                 36
>> >>>> 501-1,000               8
>> >>>> 1,001+                  16
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index