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]

st: adding a new variable to a dataset


From   Jean Sepulveda <[email protected]>
To   [email protected]
Subject   st: adding a new variable to a dataset
Date   Wed, 19 Mar 2014 14:52:52 -0300

Dear Statalisters,

I have the following problem.  Have a dataset with the unit of
interest being a person (about 10 million observations). Each person
has associated the variables, among many others, month, year and
region. Thus for every month, year and region of the country there are
thousands of observations of different people.
I now want to add a new column with the variable unemployment_rate.
This rate varies each month for each region, but does not vary among
individuals during a particular month-year-region triplet.

I have been adding the observations of the new variable in a manual
way like this:

gen unemploy=3.3 if month==1 & year==2010 & region==1
replace unemploy=4.2 if month==2 & year==2010 & region==1
replace unemploy=5.2 if month==3 & year==2010 & region==1

and so on. There are 16 different regions, and 3 years of monthly data.

Do you know of a faster way to do this?

I would appreciate any help,

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