Hello, I have a panel data and I want to keep the observation with the minimum value of Days for each InstitutionID and Accper. Then, I want to get the Median of ForecastAccuracy for each Stkcd and Accper for the observations that I keep. In other words, for any certain Stkcd and Accper, if there is more than one observation for InstitutionID, then keep the one with the lowest value of Days. After that, compute the Median of ForecastAccuracy for each Stkcd and Accper.
Stkcd Accper Rptdt Days InstitutionID ForecastAccuracy
000001 2013-12-31 2013-10-23 69 10101837 0.0054
000001 2013-12-31 2013-12-16 15 10101837 0.0108
000001 2013-12-31 2013-10-22 70 101434 0.0108
000001 2013-12-31 2013-12-15 16 101434 0.1237
000001 2013-12-31 2013-12-16 15 101506 0.9677
000001 2013-12-31 2013-10-23 69 102333 0.0108
000001 2013-12-31 2013-10-23 69 104094 0.5699
000001 2013-12-31 2013-10-23 69 104096 0.1667
000001 2013-12-31 2013-10-22 70 104102 0.0323
000001 2013-12-31 2013-11-21 40 104102 0
000001 2013-12-31 2013-10-23 69 104104 0.129
000001 2013-12-31 2013-10-23 69 10416 0.0108
000001 2013-12-31 2013-10-23 69 104169 0.1774
000001 2013-12-31 2013-10-23 69 104393 0.1129
000001 2013-12-31 2013-10-22 70 105045 0.1237
000001 2013-12-31 2013-12-31 0 105045 0.1344
000001 2013-12-31 2013-10-22 70 105523 0.0323
000001 2013-12-31 2013-10-23 69 106033 0.0376
000001 2013-12-31 2013-10-22 70 106035 0.2527
000001 2013-12-31 2013-10-23 69 106064 0.129
000001 2013-12-31 2013-10-24 68 106064 0.129
000001 2013-12-31 2013-10-22 70 106067 0.0591
000001 2013-12-31 2013-11-15 46 106067 0
000001 2013-12-31 2013-10-23 69 106068 0.0215
000001 2013-12-31 2013-10-23 69 106071 0
000001 2013-12-31 2013-10-23 69 107973 0.1183
000001 2013-12-31 2013-10-22 70 10974 0.129
000001 2013-12-31 2013-12-15 16 10974 0.129
Related Posts with keeping observation with lowest value and get the median of that
Survival analysis with inverse probability weighting after multiple imputationDear Statalist-users, Hopefully, there is someone who can help me with the following: I'm trying to…
Creating a loop to count the weeks before and after a policyHi, I'm working on understanding the impact of a hospital policy on healthcare utilization. The pol…
Plot of Interaction TermI am trying to use margins and marginsplot to plot the effect of X1 in a regression as follows: Y=a…
create a dummy variable if variables in two groups matchHello stata users, I would like to create a dummy variable if any variables in two different groups…
How to modify individual graph's title on combined graphDear Stata users, Suppose we have a combined graph that is composed of two individual graphs, let's …
Subscribe to:
Post Comments (Atom)
0 Response to keeping observation with lowest value and get the median of that
Post a Comment