The statement
tempname vmin vmax
does nothing here and could also be removed. If I were paid by the
reciprocal of the number of lines used, I wouldn't use the synonym y for
varlist but I think it makes the code a little clearer.
Nick
[email protected]
Nick Cox
*! 1.0.0 NJC 5 Jan 2009 after Stas Kolenikov
program _gstdminmax
version 8
gettoken type 0 : 0
gettoken g 0 : 0
gettoken eqs 0 : 0
syntax varname [if] [in], [BY(varlist)]
marksample touse
tempname vmin vmax
local y `varlist'
qui bysort `touse' `by' (`y') : ///
g `type' `g'= (`y' - `y'[1])/(`y'[_N] -`y'[1]) if `touse'
lab var `g' "`1' standardised to [0,1]"
end
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/