Hello everyone,
I am new to STATA and have a question regarding the preparation of my Data sample. "PERMCO" shows the respective firm id, "year" shows the year in which an M&A took place. There is two things i want to do with the data:
1.: I would like to count the number of observations for each PERMCO per year, so that at the end, for example, for PERMCO "10078" instead of four times, I have the value "2002" listed there only once, and behind it, in a new variable, information is given about the frequency of the observation 2002.
2.: I would like to add the years missing in the interval 2000-2010 for each PERMCO group. The missing values vary throughout the Dataset and are not the same missing years for every PERMCO. Since no observation has taken place in these missing values, have them output with a number of "0" according to the logic explained in point 1
I kindly ask for your help in creating a code for these concerns.
Original File:
Array
What I would like it to look like (example for PERMCO 10078 representative for the entire data set):
Array
I hope someone can help me. With best regards
Christopher
Related Posts with Counting Observations in Panel Data and filling in missing values
How to extract numbers from string with combination of text and number?How do I extract 801011001, 801011002, 801011003, etc from the variable 'parm'. Example dataset is b…
"Command ysca is unrecognized" - from help graph_combineHi, I am currently looking at the graph_combine help file to solve the problem that I have posted h…
Imputation for survival analysesDear StataList, I'm running an ophthalmic survival analysis for postoperative patients, who we want…
--collect export-- takes a really long timeHi, I like the idea of the new -collect- functions, but in my first application it take >5 minute…
no constant in XTSURI'm just wanting to know why the noconstant option is in place for the XTSUR command? Should I set u…
Subscribe to:
Post Comments (Atom)
0 Response to Counting Observations in Panel Data and filling in missing values
Post a Comment