Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: matching children and parents


From   Jeph Herrin <stata@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: matching children and parents
Date   Wed, 12 Jun 2013 13:23:36 -0400

Unique is not such an issue, since presumably if you want to lookup a value, there is only a single value to be looked up. matsize is a bigger concern, though. One should be able to get around it with via mata but I haven't tried to work it out.


On 6/12/2013 11:54 AM, Nick Cox wrote:
-matsize- limits may bite. See -help limits-.
Nick
njcoxstata@gmail.com


On 12 June 2013 16:50, Nick Cox <njcoxstata@gmail.com> wrote:
This is an attractive idea.  The restriction Jeph flags may not bite
hard as you should be able to use e.g. -egen, group()- to get unique
identifiers.


Nick
njcoxstata@gmail.com


On 12 June 2013 13:48, Jeph Herrin <stata@spandrel.net> wrote:
The lookup problem is one I often run into in Stata. That is, retrieving a
value for a variable using a (unique!) identifier from another.

One solution I have used is to store the variable of interest in a matrix.
If (!) your ID is a unique string, then you can

   mkmat education, matrix(E) rownames(ID)
   gen motheredu= el("E",rownumb("E",motherID),1)


hth,
Jeph





On 6/12/2013 3:45 AM, Andrea Smurra wrote:

Hello everyone.
I am dealing with a big household survey.
I am interested in child labor and education and my objective is to create
variables for each children representing parents or household'
characteristics.
In particular, for each children I created two variables specifying the
IDs of mother and father. Now I would like to create a  variable that, for
each children, specifies parents' education in the following way

motheredu_i=education[motherID_i]

where education is a variable already in the dataset

I know a way to do this, but it is extremely time consuming and I was
wondering what would be the syntax to create the above "function".

Thanks.
*
*   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/


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


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index