Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: rescaling a variable by the maximum value question
From
"JVerkuilen (Gmail)" <[email protected]>
To
[email protected]
Subject
st: rescaling a variable by the maximum value question
Date
Sat, 13 Oct 2012 01:49:07 -0400
I'm sure I'm simply overlooking something easy but I want to make a
new variable that is rescaled by dividing by the maximum value of the
old one. Old variable: 1, 2, 3, 4. New variable should be 0.25, 0.5,
0.75, 1.
The syntax
gen newvar = oldvar/max(oldvar)
does not work and I understand why it doesn't, because max doesn't
work that way. Is there a straightforward way to do this? (Yes I could
simply
summarize oldvar
and pick out the max by hand and rescale. I'd like to avoid that, if
possible. ;)
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/