Hi all!
I am currently writing my master's thesis using stata for the empirical part and I am stuck when it comes to the following "exercise". I was wondering if maybe someone has a solution to my problem?
I have two variables: "company" which are tickers of various stocks, and "css" which is a number ranging from 0 to 100.
I would now like to count for each company how often css is greater than 50, less than 50 or equal to 50. Additionally, I would like to have the mean of css per company. The data looks as follows:
Company CSS
AAPL 30
AMZN 46
MSFT 66
ROG 50
AAPL 60
ROG 21
......
I tried to generate a new variable containing the mean using:
bysort company: gen a = mean(css)
but after applying this code the column company was suddenly empty. Regarding the counting part (css > 50, <50, =50) I am completely lost.
I would really appreciate any kind of help
Thanks in advance and all the best,
Nicole
I am currently writing my master's thesis using stata for the empirical part and I am stuck when it comes to the following "exercise". I was wondering if maybe someone has a solution to my problem?
I have two variables: "company" which are tickers of various stocks, and "css" which is a number ranging from 0 to 100.
I would now like to count for each company how often css is greater than 50, less than 50 or equal to 50. Additionally, I would like to have the mean of css per company. The data looks as follows:
Company CSS
AAPL 30
AMZN 46
MSFT 66
ROG 50
AAPL 60
ROG 21
......
I tried to generate a new variable containing the mean using:
bysort company: gen a = mean(css)
but after applying this code the column company was suddenly empty. Regarding the counting part (css > 50, <50, =50) I am completely lost.
I would really appreciate any kind of help

Thanks in advance and all the best,
Nicole

Comment