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: Generating new variable conditional to another


From   Theocharis Kromydas <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Generating new variable conditional to another
Date   Fri, 22 Nov 2013 15:51:16 +0000

Dear Statalisters

I have a dummy variable with values 0 for those not having tertiary education and 1 for all others who hold a tertiary degree. There is a bug in my data where I could find people who responded as having a degree while also responded as having obtained less than the corresponding years to compulsory education for each country, which is impossible. The same bug applies to some others who responded as having obtained more than 18 years of education but they do not have a degree (which this is more possible to happen but quite unlikely). I have many countries with different years of compulsory education. So to make it simpler let's say that I have just one country and the years of compulsory education are 12.  So I want to generate a new variable that includes only those who responded as not having a degree with less than compulsory educational years obtained (0 value) and those who have a degree and also have more than 18 years of obtained education. (from 13 to18 years I assum!
 e that both answers can be possible).
I ‘ve tried the egen command but I can’t really get its function.
Var1(Having a degree) = (0=No 1=Yes)
Var2(Years of education obtained)=(0,1,2,3....(max=30))
Var3(New variable I want to generate)=(0 if Var2=1/12 and 1 if Var2 >18/30, copyrest(13-18 years as found in Var1)) 

Thanks, 
Harry

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