Hello,
I have a dataset that look like the following
year |
province |
familysize |
2009 |
BC |
2 |
2009 |
BC |
7 |
2016 |
AB |
5 |
2016 |
SK |
4 |
2011 |
ON |
3 |
2012 |
QC |
1 |
2013 |
PEI |
2 |
2014 |
NB |
1 |
2015 |
NL |
6 |
I would like to generate a low-income threshold variable (lico) that is different for every year, province and family size. The thresholds are in a different publication which is not in digital format. I know I can do the following
Code:
gen lico = .
replace lico = x if year==2009 & province == "BC" & familysize == 2
where little x is the threshold. The problem is that I have 7 years, 10 provinces and 7 family sizes. To do this by hand is not only time consuming but also error-prone, so I am wondering if there is a smarter/more efficient method (maybe put them in excel file and then generate lico).
Many Thanks!
Leo
0 Response to Create a new variable using external data
Post a Comment