Created
February 17, 2011 02:13
-
-
Save prasoonsharma/830809 to your computer and use it in GitHub Desktop.
Stata dynamic variables example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach i in A B C D { | |
forval n=1990/2000 { | |
local m = 'n'-1 | |
# create new columns from existing ones on-the-fly | |
generate pop'i''n' = pop'i''m' * (1 + trend'n') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment