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]

Re: st: how to calculate a new variable subtracting from an original value a unit every time a condition is satisfied


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: 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:51:46 +0000

<>

This is an FAQ. See

FAQ     . . Creating variables recording prop. of the other members of a group
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        4/05    How do I create variables summarizing for each
                individual properties of the other members of a
                group?
                http://www.stata.com/support/faqs/data-management/
                creating-variables-recording-properties/

Nick
[email protected]


On 8 January 2014 14:48, Raffaele Palladino
<[email protected]> wrote:

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