Statalist


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

st: RE: using saved values


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: using saved values
Date   Tue, 20 Jan 2009 18:58:53 +0100

Line for the server...

Nick and Maarten both steered you the way of -egen- which does indeed solve
your problem. Note, though, that -egen- creates new variables, i.e. adds a
new column to your dataset. Depending on your # of obs, that can be quite
wasteful, and students often forget to drop these vars afterwards. Instead,
they save them with the dataset which creates unnecessary confusion. If all
you want is the dummy you asked for, you are probably better off conserving
returned values in a -local- and -generate-ing your dummy based on the
-local-...

HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Lektzian, David
Sent: Tuesday, January 20, 2009 6:29 PM
To: [email protected]
Subject: st: using saved values

Dear Statalist,
I know this is a pretty simple question, but I was wondering if somebody
could tell my how to get the 75th percentile of a variable and then use it
for a future calculation.  So, specifically, using a cross-sectional time
series data set organized by country and year, I want to do the following:
By year, generate a variable with the 75th percentile value for
SqMilesOfLand
Then generate another variable =1 if the current value for a country of
SqMilesOfLand > 75th percentile.
Then I want to do the same thing for less than the 25th percentile, and
another dummy for being between the 25th and 75th percentiles.

A more general question is that I can't figure out how to call out saved
values from something like summarize and use them in future calculations.

Any help/instruction would be greatly appreciated.

Dave



*
*   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/

*
*   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/



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