Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: gsort issue


From   "Rajesh Tharyan" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: gsort issue
Date   Thu, 5 Jul 2007 13:41:34 +0100

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index