I am new to Stata and have some questions about data management.
In the following sample, I have a data with three variables, CONM, DATE, and SALES. What I want to do is to build a logic that can detect the validity of the observations. That is, for each company in each year, its smallest sales must take up at least 10% of the total sales.
For example, for company 2U INC, in 2012, its total sales is 43.6+8.4=52.0, if the smallest sales 8.4 takes up at least 10% of the total sales, 52.0, we can say the result is "valid" (can be denote as dummy variable 1 or anything else). For the same company 2U INC, in 2015, its total sales is 65.2+23.8+17.6=106.6, and the smallest sales 17.6 still takes up more than 10% of the total sales, the result is "valid".
The detect procedure should be categorized based on both company and date.
Can Stata work this logic out properly? Is there any good suggestions about this issue?
Advanced big thanks here.
CONM DATE SALES
2U INC | 12/31/2012 | 43.586 |
2U INC | 12/31/2012 | 8.382 |
2U INC | 12/31/2013 | 13.3 |
2U INC | 12/31/2013 | 57.358 |
2U INC | 12/31/2014 | 60.631 |
2U INC | 12/31/2014 | 15.433 |
2U INC | 12/31/2015 | 65.2 |
2U INC | 12/31/2015 | 23.8 |
2U INC | 12/31/2015 | 17.6 |
2U INC | 12/31/2016 | 22.1 |
2U INC | 12/31/2016 | 36.7 |
2U INC | 12/31/2016 | 71 |
2U INC | 12/31/2017 | 28.3 |
2U INC | 12/31/2017 | 77.6 |
2U INC | 12/31/2017 | 48.2 |
2U INC | 12/31/2018 | 54.2 |
2U INC | 12/31/2018 | 42.7 |
2U INC | 12/31/2018 | 86.9 |
360 SECURITY TECHNOLOGY INC | 12/31/2010 | 12.167 |
4LICENSING CORP | 12/31/2010 | 5.646 |
4LICENSING CORP | 12/31/2011 | 5.556 |
4LICENSING CORP | 12/31/2012 | 2.494 |
4LICENSING CORP | 12/31/2012 | 0.333 |
6D GLOBAL TECHNOLOGIES | 12/31/2010 | 6.91 |
6D GLOBAL TECHNOLOGIES | 12/31/2010 | 6.687 |
6D GLOBAL TECHNOLOGIES | 12/31/2010 | 3.344 |
6D GLOBAL TECHNOLOGIES | 12/31/2010 | 2.675 |
6D GLOBAL TECHNOLOGIES | 12/31/2011 | 3.369 |
6D GLOBAL TECHNOLOGIES | 12/31/2011 | 2.305 |
6D GLOBAL TECHNOLOGIES | 12/31/2011 | 3.724 |
6D GLOBAL TECHNOLOGIES | 12/31/2011 | 3.724 |
6D GLOBAL TECHNOLOGIES | 12/31/2012 | 2.073 |
6D GLOBAL TECHNOLOGIES | 12/31/2013 | 2.122 |
6D GLOBAL TECHNOLOGIES | 12/31/2013 | 1.061 |
6D GLOBAL TECHNOLOGIES | 12/31/2013 | 0.299 |
6D GLOBAL TECHNOLOGIES | 12/31/2013 | 1.061 |
0 Response to How to build a logic to test the validity of observations in Stata?
Post a Comment