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
SummationI am new to STATA, and I am trying to run a regression with a summation in it so that it creates mul…
Different Numbers Across An IdentifierHi Everyone, I have a dataset that has two variables: 1) An identifier denoted here as MRN. 2) Tes…
Robustness check for cross-sectional data by merging datasets and creating year dummy variableI am currently working on the effects of maternal education on child mortality with cross-sectional …
Creating per capita income from IPUMS ACS dataset across multiple yearsI'm working on ACS dataset which doesn't provide number of population in 50 states across different …
Case-sensitivity in Windows 10/1803+The Microsoft Windows update 1803 has introduced case-sensitivity as a configurable option for Windo…
Subscribe to:
Post Comments (Atom)
0 Response to Counting number of categories in a variable by group
Post a Comment