You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
In my data set column A is given. I would like to compute the second column. The values are calculated based on how many times the value in the same row of column A occurs in total in column A. For example, the first row: the value 1 occurs 3 times in column A. Hence, in CountA there is a 3 for all 1s. Is there a specific count demand that can be used to do this?
Please don't use the terms row and column when referring to Stata data sets. That terminology is appropriate for spreadsheets, but Stata is not a spreadsheet. And if you try to do things in Stata based on your habits from using spreadsheets, you will often find yourself going far astray. So it is important to keep the terminology separate in your mind: Stata datasets have variables and observations, not columns and rows.
Do read -help by- to learn about the -by:- prefix and how it works with _n and _N.
Leave a comment: