Bookmark and Share

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: reverse lookup


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   st: reverse lookup
Date   Tue, 08 Jan 2013 14:07:59 -0500

All,

I've just written the same awkward code for the untoldth time, and I'm thinking there must be a better way to do it.

The problem is to get a particular value of a variable into a local which corresponds to a particular value of another variable. I think this is usally call reverse lookup. For example, I might have -period- and -rate- and want to store the value of -rate- which corresponds to period = 1. My lazy solution is


 sum rate if period = 1
 local rate1 `=r(mean)'

That is, I summarize a single observation, then put the mean in local. Is there a better way to do this?

thanks,
Jeph

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index