Dear all,
Please take a look at the attached dummy dataset screenshot. How do I generate a variable "Number" which tells me the number of colours per district? For example, for district A, Number should be 2, as there are 2 colours - BLUE and PINK. Similarly, for District B, Number should be 3, as there are 3 colours overall - BLUE, PINK and RED.
The actual dataset has way more colours and districts than just a few.
Thanks in advance!
Related Posts with Counting number of categories in a variable by group
merging different data with different countries and different yearsIs there a way to merge different datasets with different countries and different years, and then ch…
Generating new variable using forvaluesHi, I am having trouble using forvalues to generate a new variable. My problem is this: I have a var…
No triangle line on funnel plot (Network meta analysis)I try to draw funnel plot but it does not show tri-angel line. …
Weighted Tabulation by Multiple Groups -- Export to XLS or DTAHello, I am using YRBS data -- a student survey taken in each US state every other year. Each entry …
Technical question regarding (margins) command and average probabilitiesDear Statalist user and experts, I used a probit command to run just simple probit regression. And …
Subscribe to:
Post Comments (Atom)
0 Response to Counting number of categories in a variable by group
Post a Comment