Hello Stata professionals,
I have a Data set of different ID's, each ID has observations from their age 20 up to age 55 with country of origin and year, in which they are at each age.
I have now generatet a variable where you can see whether there is a economic crisis =1 or not=0 in each year and country of origin.
now i want to count the number of crisis these people have had during their age 20 and 55:
How do I do it ?
example of first 5 rows:
+----------------------------------------------------------+
mergeid yrbirth age year country crisis_1
1. AT-001215-01 1939 43 1982 Austria 0
2. AT-001215-01 1939 30 1969 Austria 0
3. AT-001215-01 1939 26 1965 Austria 0
4. AT-001215-01 1939 41 1980 Austria 0
5. AT-001215-01 1939 25 1964 Austria 0
***there are way more mergeid's than just one
Related Posts with How to count occurrences by id
Tests of significance in by-group summary statisticsHello, I have split my sample into three time periods (pre-GFC, GFC, post-GFC) when reporting summa…
Returning pointer matrixes in functionsThis idea is probably well known to serious Mata programmers, but I've recently come across what app…
Creating new dummyI have a dataset on companies with distinct id, products they sell, the region they sell their produ…
Reshape with many variablesDear All, I have a very large dataset (approx. 29,000 variables) which looks like this: Code: * E…
Problem with String Variable in Collapse CommandDear all, I am using Stata 16, on mac. I must collapse my data to region-by-year level. The problem…
Subscribe to:
Post Comments (Atom)
0 Response to How to count occurrences by id
Post a Comment