Let me edit my question to clarify. Here is the python code:
decade_begin = 1970
while decade_begin <= 1994:
for x in range(0, 10):
a= decade_begin + x
decade_begin = a+1
decade_end=a
print "year_",decade_begin,"s" #start year
The output of the last line is:
year_1980s
year_1990s
I want to be able to create a variable such that:
year_1990s = [a]
In stata this is quite easy, using a local macro `x'. But in python I think mixing string and int in a variable name is not allowed.
forval i = 1979/1994 {
whatever if year == `i'
save year_`i'.dta, replace
}
Any ideas on how to implement in python?