Hi,
Im working with a dataset that contains 120 funds (id=1,120) and I have constructed two periods (period1 and period2). I now want to create a new variable that counts how many observations I have in each period.
See below for dataex.
In this case I would like the new variable obs_p1 to take the value 7 and the new variable obs_p1 to take the value 5.
Any suggestions about the code I need?
Thanks!
----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input float
(id period1 period2)
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
Related Posts with Count observations in periods
Loops within weeklong periodHello Statalist. Happy New Year. This post is an extension of a previous post of mine that I've yet…
Want to regress institutions and some qualitative variables on GDPI want to regress institutions and some qualitative variables on GDP, I know that institutions varia…
Calculating common ownership based on a formula with multiple summationsDear all, Assume that we have a dataset that has the following form: Code: input firm_id year …
Correlation of one variable between players in panel dataHi all, I am working with a panel dataset regarding financial products. The dataset has about 200,0…
Overlapping labels of pie chartDear Statalisters, I have to report several pie charts in a study. However, I face with the problem…
Subscribe to:
Post Comments (Atom)
0 Response to Count observations in periods
Post a Comment