Calculate total grants
company_id |
year |
grant |
co_001 |
2003 |
1 |
co_001 |
2004 |
0 |
co_001 |
2005 |
1 |
co_001 |
2005 |
1 |
co_002 |
2005 |
0 |
co_002 |
2006 |
1 |
co_002 |
2006 |
1 |
co_002 |
2006 |
1 |
co_003 |
2007 |
1 |
co_003 |
2007 |
1 |
co_003 |
2007 |
1 |
co_003 |
2007 |
1 |
co_004 |
2008 |
0 |
co_004 |
2011 |
1 |
- Create the formula/command/code for the variable total_grants. For example, co_001 received 1grant in 2003, 0 grants in 2004 and 2 grants in 2005.. I
- I have used the code: collapse(sum) grant , by (company_id year)
- then rename grant total_grants. I dont know if Im correct or not. Kindly review my working also help me to understand how can we use bysort command.
- Thank you , Seniors.
No comments:
Post a Comment