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]

From |
Robson Glasscock <glasscockrc@vcu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Change variable |

Date |
Sat, 10 Sep 2011 11:53:07 -0400 |

So File 1 is a panel data set that records each individual's educational level over time? If that is the case, and if File 2 is also panel data, then a 1:1 merge based on x1(unique id) and x3(time period) could be done. If File 2 is not panel data, then you're looking at a m:1 merge based on x1(unique id). If this doesn't solve the problem, I think you should include an example of the observations in each of your files on your next post. I'm still struggling a bit to picture the contents of your files. On Sat, Sep 10, 2011 at 9:20 AM, Ay <yuniphone@yahoo.co.id> wrote: > Dear Robson, > > Thank you for replying. > > Actually, > File 1: > x1 (unique id) > x2 (educational level) > > File 2 > x1 (unique id) > > > In file 2, x1 & x2 together are unique id. All of the variables are in strings. > > I could not merge file1 and file 2 since x2 is the educational level in which an individual would have more than 1 level/type. > > Thank you, > > Yun > > > > > > > On 10 Sep 2011, at 22:56, Robson Glasscock <glasscockrc@vcu.edu> wrote: > >> I'm having a hard time understanding the structure of your "first >> file" and your "second file. Do your files looks like this: >> >> File 1: >> x1 >> (unique id + educational level) >> >> File 2: >> x1 >> (unique id) >> >> so that File 1 contains a concatenated variable? >> >> If File 1 has one variable, x1, that is concatenated, then I don't >> think you need to merge the files together to get what you want. You >> would just need to split x1(unique id + educational level) into >> x1(unique id) and x2(educational level). The substr function may be >> used to do this. >> >> -help substr- >> >> best, >> Robson Glasscock >> >> On Fri, Sep 9, 2011 at 5:27 PM, Ay <yuniphone@yahoo.co.id> wrote: >>> >>> I am using stata 11.0 >>> >>> How can i generate or change a variable that contains for instance, educational level or father and mother as 'Type'? >>> The variables are in strings format. >>> >>> The reason i am asking this question is that, i want to merge these 'type' variable (var B) with other variable. >>> I could not do this since the second file only has variable A as individual id variable. While in the first file, it has var A and var B ('type' or level variable) as unique Id. >>> >>> If anyone knows other ways besides generating the type variable before merging, I really appreciate it. >>> >>> Variable a >>> 1,2,1,1,2,3,3 >>> >>> Variable b(type) >>> A,A,B,C,B,C,A >>> >>> Many thanks. >>> >>> Regards, >>> >>> Yun >>> >>> >>> >>> >>> >>> * >>> * 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/ > > * > * 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/

**Follow-Ups**:**Re: st: Change variable***From:*Ay <yuniphone@yahoo.co.id>

**References**:**st: Change variable***From:*Ay <yuniphone@yahoo.co.id>

**Re: st: Change variable***From:*Robson Glasscock <glasscockrc@vcu.edu>

**Re: st: Change variable***From:*Ay <yuniphone@yahoo.co.id>

- Prev by Date:
**st: Negative binomial regression (nbreg): Plot an interaction effect of two continuous/interval variables** - Next by Date:
**RE: st: Negative binomial regression (nbreg): Plot an interaction effect of two continuous/interval variables** - Previous by thread:
**Re: st: Change variable** - Next by thread:
**Re: st: Change variable** - Index(es):