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: RE: combine two datasets


From   wanhaiyou <[email protected]>
To   [email protected]
Subject   Re: st: RE: combine two datasets
Date   Thu, 19 Dec 2013 10:38:30 +0800 (GMT+08:00)

Thanks Joe,
You are right. I think append does require that the datasets 
have the same variables at first. Actually,it is not. Your codes
are prefectly.

Bests,
wanhaiyou
Hunan University



> -----原始邮件-----
> 发件人: "Joe Canner" <[email protected]>
> 发送时间: 2013-12-19 09:46:57 (星期四)
> 收件人: "[email protected]" <[email protected]>
> 抄送: 
> 主题: st: RE: combine two datasets
> 
> Wanhaiyou,
> 
> Try:
> 
> use A, clear
> append using B
> sort id year
> 
> This is a pretty basic Stata operation, so you should probably spend some time familiarizing yourself with the Stata -help- command and other online resources that provide Stata tutorials.
> 
> Regards,
> Joe Canner
> Johns Hopkins University School of Medicine
> ________________________________________
> From: [email protected] [[email protected]] on behalf of 游万海 [[email protected]]
> Sent: Wednesday, December 18, 2013 7:53 PM
> To: [email protected]
> Subject: st: combine two datasets
> 
> Dear all,
> 
> I have two dataset A and B,
> A:
> id  year  var1 var2
> 1  2001  1        2
> 1  2002  3       4
> 1  2003  5       6
> 2  2001  1        2
> 2  2002  3       4
> 2  2003  5       6
> 3  2001  1        2
> 3  2002  3       4
> 3  2003  5       6
> 
> 
> B:
> id year var1 var2
> 1 2004    1     2
> 2 2004    3    4
> 3 2004    5    6
> 
> And I want to obtain the dataset C
> id year  var1 var2
> 1  2001  1        2
> 1  2002  3       4
> 1  2003  5       6
> 1  2004  1        2
> 2  2001  1        2
> 2  2002  3       4
> 2  2003  5       6
> 2  2004  3       4
> 3  2001  1        2
> 3  2002  3       4
> 3  2003  5       6
> 3  2004  5      6
> 
> Thanks very much
> 
> Bests,
> wanhaiyou
> Hunan University
> 
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index