Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: rescaling a variable by the maximum value question

From   "JVerkuilen (Gmail)" <>
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

     summarize oldvar

and pick out the max by hand and rescale. I'd like to avoid that, if
possible. ;)
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index