Home > database >  How to generate a new variable that shows the frequency of observations of another variable?
How to generate a new variable that shows the frequency of observations of another variable?

Time:10-27

Let's say I have a variable in Stata: house number.

I want a new variable that tells me the frequency of each value of 'house number'.

CodePudding user response:

bysort house_number : gen frequency = _N
  • Related