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: If variable x contains variable y


From   Steve Nakoneshny <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: If variable x contains variable y
Date   Sun, 15 Jul 2012 08:59:47 -0600

John,

At first glance, it would seem that -gen x = y if y = z- would serve as a solution. Of course, this assumes that your I'd vars are numerical and not string vars (which they probably should be stored as).

Steve

Sent via carrier pigeon

On 2012-07-15, at 8:52 AM, "[email protected]" <[email protected]> wrote:

> Hello,
> 
> 
> This is my first time using statalist, I hope I do this all correctly!
> 
> 
> I'm looking to create a variable x which is equal to y, but only if the given value for y can be found in another variable, z. These are all id numbers, so say y is a universal id and z is a mother's id, telling you the universal id of the mother in relation to the child.
> 
> 
> For example:
> 
> 
> yzx
> 
> 
> 1..
> 2.2
> 3.3
> 42.
> 5..
> 6..
> 737
> 8..
> 9..
> 107.
> 
> 
> So I'm trying to figure out how to create x. Any help would be much appreciated.
> 
> 
> Thanks,
> John
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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