Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Query re -sortpreserve-


From   [email protected]
To   [email protected]
Subject   st: RE: Query re -sortpreserve-
Date   Fri, 20 Jun 2003 12:02:57 -0400

Roger Newson
> I am trying to use -sortpreserve- in Stata 7 and Stata 8 
> under Windows 
> 98/SE. However, there is one problem. My -sortpreserve- 
> programs do not 
> seem to be generating a -`sortindex'- temporary variable, as -[P] 
> sortpreserve- says they should. (A simple example under Stata 
> 8 is given 
> below.) Why should this be the case?
> 
> Best wishes (and thanks in advance)
> 
> Roger
> 
> . prog def nutz1,sortpreserve
>    1. version 8.0
>    2. disp as text "Sort index var: |`sortindex'|"
>    3. sort `sortindex'
>    4. end
> 
> . nutz1
> Sort index var: ||
> varlist required
> r(100);


There is a typo in the manual under [P] sortpreserve (p. 402 under section
'How sortpreserve works').  A leading underscore is missing from the macro
name used for the sortpreserve variable.  References to `sortindex' should
be replaced by `_sortindex' everywhere.  The following will work:

prog def nutz1,sortpreserve
	version 8.0
	disp as text "Sort index var: |`_sortindex'|"
	sort `_sortindex'
end


. nutz1
Sort index var: |__000000|


Patrick Joly
[email protected]
[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/



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