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: how to calculate a new variable subtracting from an original value a unit every time a condition is satisfied


From   Raffaele Palladino <[email protected]>
To   [email protected]
Subject   st: how to calculate a new variable subtracting from an original value a unit every time a condition is satisfied
Date   Wed, 8 Jan 2014 14:48:53 +0000

Dear statalist users,

                             I am dealing with the following problem:
I have to calculate a variable that expresses how many people of the
family are living together. I have a variable that says how many
people compose the family (family_number) and several variables
(member1, 2 etc) that express whether the person is still living in
that family or not (they goe from 1 which means that the member still
lives in, to 5, all the others mean different conditions, all
expressing that the member is living elsewhere).
I would need to calculate a new variable which is basically equal to
family_number but that also subtracts a unit every time one of the
variables member* is not equal to 1 (there are missing values as well
in the dataset). Is there a way to obtain it?
thank you in advance
*
*   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