Hi,
Sorry for a typo,
In your case it should be gsort -phdif not gsort phdif as I posted earlier..
replace phdif=phdif *-1
gsort -phdif,mfirst
replace phdif=phdif *-1
di phdif[_N]
thanks
r
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Rajesh Tharyan
Sent: 05 July 2007 13:42
To: [email protected]
Subject: st: RE: RE: gsort issue
Hi,
How is this?
sysuse auto,clear
list rep78 in 74
* the prob with just using gsort ( reproduces martens example..)
gsort rep78,mfirst
list rep78 in 74
* work round the prob
replace rep78=rep78*-1
gsort -rep78,mfirst
replace rep78=rep78*-1
list rep78 in 74
so in your case try ..
replace phdif=phdif *-1
gsort phdif,mfirst
replace phdif=phdif *-1
di phdif[_N]
thanks
rajesh
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Maarten Buis
Sent: 05 July 2007 13:08
To: [email protected]
Subject: st: RE: gsort issue
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
--- Fred Wolfe wrote:
> 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.
<snip>
> The problem appears to be that missings are still last even though I
> used the -mfirst- option.
The same issue appears in Stata 9:
. sysuse auto, clear
(1978 Automobile Data)
. gsort rep78, mfirst
. list rep78 in 74
+-------+
| rep78 |
|-------|
74. | . |
+-------+
Maarten
*
* 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/
*
* 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/
*
* 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/