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
Calibration of logistic regression on large dataset.Evaluating goodness-of-fit for a logistic regression model using the Hosmer-Lemeshow test is not rel…
Generate a moving window averageIs there an easy way to generate a moving window average? For instance, for every 5 minutes of Ta_NO…
Can I use tssmooth for a fixed number of periods like a rolling forecast, safe the forecast t+5, then start in t+1, save forecast t+6...Hello everybody, I'm trying to forecast values for the strategy of companies. I have a panel datase…
Question about reghdfeCould you please answer my questions about reghdfe command? 1. When I conducted estimation using…
Weak IV test postestimation test when using ivreghdfe command?Dear STATA community, I am hoping you can help me find a command I am looking for. My coauthor and …
Subscribe to:
Post Comments (Atom)
0 Response to How to create a formla
Post a Comment