Dear Michael
Your code did not work. When I use your code, sourcecountrygpd is identical
to destinationcountrygdp; but they must be different.
Simo
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Michael Blasnik
Sent: Tuesday, October 31, 2006 11:57 PM
To: [email protected]
Subject: st: Re: data management question
...
use masterdata
keep sourcecounty sourcegdp
rename sourcecountry destinationcountry
rename sourcegdp destinationgdp
bysort destinationcountry: keep if _n==1
sort destinationcountry
save gdps
use masterdata
sort destinationcountry
merge destinationcountry using gdps, nokeep
tab _merge
* check that all countries are there
drop _merge
Michael Blasnik
----- Original Message -----
From: "Simo Hansen" <[email protected]>
To: <[email protected]>
Sent: Tuesday, October 31, 2006 4:38 PM
Subject: st: data management question
> Dear All,
> I have the following data set:
>
> SourceCountry DestinationCountry Source CountryGDP Destination
> CountryGDP
> USA USA 100
> USA ENGLAND 100
> USA FRANCE 100
> ENGLAND USA 75
> ENGLAND ENGLAND 75
> ENGLAND FRANCE 75
> FRANCE USA 50
> FRANCE ENGLAND 50
> FRANCE FRANCE 500
>
> My goal is to create a column for Destination Country GDP using
> information
> in the column of Source Country. My data should look like in the following
> form:
> SourceCountry DestinationCountry Source CountryGDP
> DestinationCountryGDP
> USA USA 100
> 100
> USA ENGLAND 100 75
>
> USA FRANCE 100 50
>
> ENGLAND USA 75 100
> ENGLAND ENGLAND 75 75
> ENGLAND FRANCE 75 50
> FRANCE USA 50 100
>
> FRANCE ENGLAND 50 75
> FRANCE FRANCE 50 50
> Unortunayely, I cannot figure out how to this. Any help would be greatly
> appreciated.
> Best regards,
> Simo
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/