Hello,
I am trying to figure out how to create a dummy variable for the first duplicates of the year and the country. My dataset is about civil conflict events that occur in a certain year (styr) in a certain country (ccode) and it looks like this. There are many more variables, but I don't think I need them for this. (Although I am not sure as I am not very good at working with stata.. So please let me know if you need any more info)
I have created the dup variable by using the following command: duplicates tag ccode styr, gen(dup).
I saw this in another forum and it does show how many duplicates there are per styr but now I don't know how to proceed. I've looked at many other forums but haven't found one that really answers my question.
So, I want to create a dummy that gives value 1 only for the first event per country / year 'match'. So in the picture I uploaded this would be for observation 1, 3, 4, 7, 16, 18, 19, 20, etc.
Array
I hope you can help as I have been stuck on this for quite a while now. Thanks!
Related Posts with Dummy for first duplicate
Stata Graph for Panel Data in quartersGreetings to the forum! I have a panel dataset with 5 retailing companies for 15 years in quarters:…
Seemingly unrelated regressions: when using and results interpretationDear all, I recently run into some seemingly unrelated regressions and did some attempts to compare …
estimate time varying coefficientsHello, In my dataset for my gravity model, i have 6 time periods (1990 1995 2000 2005 2010 2015) an…
Panel Var + IVHi, Im totally new to Stata. Please help me. I would like to find the impact of government spending…
Small sample and regression issuesDear Stata Experts, In one of my paper, I have used 30 firms over the year 8 years (total 198 firm-…
Subscribe to:
Post Comments (Atom)
0 Response to Dummy for first duplicate
Post a Comment