Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Data Manipulation Question


From   "Lektzian, David" <[email protected]>
To   <[email protected]>
Subject   st: Data Manipulation Question
Date   Fri, 8 Feb 2008 17:38:15 -0600

Dear Statlist:

I'm stuck and was hoping somebody could help.  I have data on country,
country code (ccode), year (1980-2007), and drug seizures.

I want to make a new variable drug seizure plus that adds seizures from
overseas territories to a country's total.  For example, I have:

Country            code    year   seiz   seizplus
Britain            200     1980   100      200
Britain            200     1981   150      300
.
.
.
US                 2       1980   200      250
US                 2       1981   250      325
.
.
.
Brit Virg Isl.       .     1980    50
Brit Virg Isl.       .     1981    75
.
.
.
Cayman Isl.       .        1980    50
Cayman Isl.       .        1981    75
.
.
.
US Virg Isl.       .       1980    50
US Virg Isl.       .       1981    75

The country codes are missing for those "countries" that are not really
countries.  What I want to do is to identify which territories belong to
which countries and then write a line of code that adds seiz for Britain
in 1980 to seizures for Brit Virg Isl + Cayman Isl. +....etc for all
their territories.  Then I would repeat for the US, France, Netherlands,
etc.  I'm guessing there is an easy way to do this, but I don't know how
to add two values in the same variable at different years, matching them
based on a string name and then putting the sum in an additional
variable.  I have to do this for 8 different types of drug seizures so I
didn't want to just do it by hand.  After I capture this additional
seizure data, I will then drop the territories from the analysis as they
do not match with other variables in the analysis I need to do.

Any help would be greatly appreciated.

Thanks,
Dave



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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index