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: How can I get the second last non-missing value?
From
duygu yıldırım <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: How can I get the second last non-missing value?
Date
Wed, 12 Jun 2013 23:27:09 +0300
Hello everyone,
I use a cross-sectional individual level data set. I want to ask if there is a way that I can create a variable which consists the second last non-missing value within observations?
for example;
id v1 v2 v3 v4 v5
1 1 2 3 . .
2 1 2 . . .
3 1 2 3 4 .
So the variable that I want to create is;
id v6
1 2
2 1
3 3
I can get the last non-missing value within observation by using the rowlast command, but I also need the one just before the last one.
Thank you all very much for any help,
Duygu.
*
* 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/