Hello Statalisters,
I am having an issue with using the stored `r(min)' value from a sum command. I am looking at test results for schools and I want to keep all schools that have test data less than or equal to the minimum value of the conditions that I have set. When I run the code, it is not keeping the school that has the minimum value found in the sum command. What am I doing wrong?
Here is a sample of my data
When I run:
It does not keep the 2 observations that are equal to the minimum value:
I am having an issue with using the stored `r(min)' value from a sum command. I am looking at test results for schools and I want to keep all schools that have test data less than or equal to the minimum value of the conditions that I have set. When I run the code, it is not keeping the school that has the minimum value found in the sum command. What am I doing wrong?
Here is a sample of my data
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long schl float(keep percent_on_gl2015Math) 7846 . 0 3849 . .0363 6492 . .0388 3847 . .0467 7855 . .0533 8148 1 .0588 8308 . .0588 8303 . .0625 7852 . .0714 5286 . .0714 6172 . .0714 7506 . .0769 7922 . .0816 5275 . .0909 7245 . .0921 3857 . .0956 7293 . .1026 3851 . .1038 6675 . .104 7255 . .1041 end
When I run:
Code:
sum percent_on_gl2015Math if keep ==1 Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- percen~5Math | 14 .3142571 .1791266 .0588 .6587 . keep if percent_on_gl2015Math <= `r(min)'
It does not keep the 2 observations that are equal to the minimum value:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long schl float(keep percent_on_gl2015Math) 7846 . 0 3849 . .0363 6492 . .0388 3847 . .0467 7855 . .0533 end