Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72927

Count frequency of observation within a variable

$
0
0
Hi,

I would like to count the frequency of an observation within a variable.
Thus, I would like to create a variable "a" which refers to variable"x" in the following pattern:

variable "x" 1 1 1 2 2 2 2 2 6 7 7 7 8 8
variable "a" 3 3 3 5 5 5 5 5 1 3 3 3 2 2

Basically "a" counts how many times "x" is 1, how many times "x" equals 2 etc.

Does someone know how to do that?
I was unable to find anything in that direction..

Thanks,
Xueqian

Viewing all articles
Browse latest Browse all 72927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>