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: Subtract Closest Cell Which has A Value
From
Lisa Wang <[email protected]>
To
[email protected]
Subject
st: Subtract Closest Cell Which has A Value
Date
Fri, 26 Oct 2012 13:41:46 +1100
Dear all,
I have another question. I have two columns of values - variables A
and B to make it simple. I would like to A-B in a new column C;
however, column B has a lot of missing values (.), so it doesn't seem
that simple. Variable A is complete, so no missing data. I would like
Stata to find the nearest cell (data is already sorted by column D)
with a value in column B to subtract off for each panel that I have.
For instance,
51 . 31
50 . 30
47 20 27
51 . 31
25 . 5
49 . 29
45 . 25
24 . 4
51 . 1
22 . -28
27 . -23
57 . 7
20 . -30
57 50 7
59 . 9
33 . -17
Would this be possible?
Many thanks,
Lisa
*
* 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/