|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: gsort issue
Is there a problem with gsort (Stata 10 and below) or am I
misunderstanding something?
I have a variable called -phdif-. I want the greatest value of that
variable to appear in the last observation. There are missing values,
so I use -gsort- with the -mfirst- option.
. fre phdif
phdif -- Number of phases to next observation
-----------------------------------------------------------
| Freq. Percent Valid Cum.
--------------+--------------------------------------------
Valid 1 | 132486 77.97 90.91 90.91
2 | 9078 5.34 6.23 97.14
3 | 2456 1.45 1.69 98.82
4 | 1032 0.61 0.71 99.53
5 | 272 0.16 0.19 99.72
6 | 140 0.08 0.10 99.82
7 | 111 0.07 0.08 99.89
8 | 72 0.04 0.05 99.94
9 | 49 0.03 0.03 99.97
10 | 28 0.02 0.02 99.99
11 | 7 0.00 0.00 100.00
12 | 2 0.00 0.00 100.00
Total | 145733 85.77 100.00
Missing . | 24181 14.23
Total | 169914 100.00
-----------------------------------------------------------
. gsort phdif
. l phdif in 1,clean
phdif
1. 1
. l phdif in l,clean
phdif
169914. .
. gsort phdif,mfirst
. l phdif in 1,clean
phdif
1. 1
. l phdif in l,clean
phdif
169914. .
The problem appears to be that missings are still last even though I
used the -mfirst- option.
Any suggestions? Is this a problem or am I thinking about this incorrectly?
Thanks.
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel +1 316 263 2125
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/