I have to create 5 variables x1 to x5 so I use
Code:
foreach x of newlist x1-x5{ gen `x' = 2*x }
Code:
x1 = 2*x x2 = 4*x x3 = 6*x x4 = 8*x x5 = 10*x x = rnormal()
Thanks for your help
Patrick
Specialized on Data processing, Data management Implementation plan, Data Collection tools - electronic and paper base, Data cleaning specifications, Data extraction, Data transformation, Data load, Analytical Datasets, and Data analysis. BJ Data Tech Solutions teaches on design and developing Electronic Data Collection Tools using CSPro, and STATA commands for data manipulation. Setting up Data Management systems using modern data technologies such as Relational Databases, C#, PHP and Android.
foreach x of newlist x1-x5{ gen `x' = 2*x }
x1 = 2*x x2 = 4*x x3 = 6*x x4 = 8*x x5 = 10*x x = rnormal()
0 Response to Foreach Stata 13
Post a Comment