code year var2 top5
1100 201712 5 1
1100 201712 5 2
1100 201712 5 3
1100 201712 4.9 4
1100 201712 4.8 5
1200 201712 6 1
1200 201712 5.9 2
1200 201712 5.4 3
1200 201712 5.4 4
1200 201712 5.4 5
1300 201712 6 1
1300 201712 2 2
1300 201712 1 3
1300 201712 3 4
1300 201712 2 5
1300 201812 6 1
1300 201812 6 2
1300 201812 5 3
1300 201812 4 4
1300 201812 4 5
Dear all ,this is a part of my data.As you can see I sort by code and year.I want to generate a variable.
This variable requires a complicated calculation process. The process is as follows: First, I want to calculate {(1-2)^2+(2-3)^2+(3-4)^2+(4-5)^2}/100 in top5, 1 to 5in the formula must be brought into the value in var2.Thank u so much.
Related Posts with How to create a formla
Test difference between predicted valuesHello, I have a model which is regressing log wages on being immigrant/native. However, immigrant a…
Calculating the proportion of observations that fulfill successive conditionsDear Statalisters, I have data following movements of cyclists through designated checkpoints. Each…
Map integration: Distance from tube station?Is there a Stata package that can calculate the distance of an address from a category of landmarks?…
Interpreting AME after margins commandDear all, I am using the -margins- command to estimate the impact of several binary explanatory var…
Fitting Random Slope in Mixed ModelsGreetings Experts, I use stata version 15.0. I have longitudinal data that I am trying to fit some …
Subscribe to:
Post Comments (Atom)
0 Response to How to create a formla
Post a Comment