Hello,
I have data involving auctions and contracts. My task is to find the average of the winning bids. So, I used this code to get a formula for the max bid by contract:
egen maxbid= max(bid), by(contractnum).
My problem is that the values for maxbid are repeated every time a certain contract is mentioned. For example, contract 08-492904 has 7 bidders, so the winning bid is listed 7 times. As you can see, this would create incorrect values for the mean if I did sum maxbid. So, how can I fix this error?
Related Posts with Finding a mean when values are repeated
Coding a new categorical variable based on an existing categorical variableHi Statalist. I would like to create a few groups based on some of the categories of an existing va…
egen var1= count(var), by(id quarter) - generating missing valuesHello, I have a dataset which is organised by id and quarter. I want to create a variable, based on…
capture a change over time within idHi I have a panel data of N couples (id) over 6 time periods the variable h_child is equal to "1" if…
egen command is only generating missingsHello, i used the egen in previous data anlysis and it worked pretty well. The code looked somehti…
How to change the width of bars in a catplot graphHello everyone, I generated a bar graph using the catplot command for two categorical variables and…
Subscribe to:
Post Comments (Atom)
0 Response to Finding a mean when values are repeated
Post a Comment