Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72771

Counting unique observations by group, before a certain date

$
0
0
Dear Statalist,

I want to count the unique number of projects done by a company before the first_idate ("experience"). How do I get from my inputs to my desired output?

Thank you in advance!


Input:
Code:
clear
input float(company fund idate project iamount first_idate)
1 1 2000 1 10 2000
1 2 2001 2 9 2001
1 2 2002 2 8 2001
2 1 2003 1 4 2003
2 1 2004 1 3 2003
3 1 2003 1 12 2003
3 3 2004 2 14 2004
3 4 2006 3 22 2006
4 1 2000 5 15 2000
4 2 2000 6 6 2000
end
Output:
Code:
   clear
  input float(company fund idate project iamount first_idate experience)
  1 1 2000 1 10 2000 0
  1 2 2001 2 9 2001 1
  1 2 2002 2 8 2001 0
  2 1 2003 1 4 2003 0
  2 1 2004 1 3 2003 0
  3 1 2003 1 12 2003 0
  3 3 2004 2 14 2004 1
  3 4 2006 3 22 2006 2
  4 1 2000 5 15 2000 0
  4 2 2000 6 6 2000 0
  end

Viewing all articles
Browse latest Browse all 72771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>