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
Reporting Adjusted R2 on StataHello Everyone! I am new to STATA and I am having trouble reporting the Adjusted R2 When I run a re…
Expanding years for mergingDear Statalist William Lisowski I would like to generate the year 2009, 2010, 2012, 2013, 2015, 201…
What is the syntax of Panel ARDL model with DCCE estimator (xtdcce2)?Dear all, I am learning Stata and trying to find out how to use the xtdcce2? I installed xtdcce2 v…
Unique Identifier for Time SeriesHi Everyone, I am not sure if I need to create a unique ID for time series data. I have annual data…
The GEE and regression with robust error varianceHi Statisticians, Is any one known the difference of GEE and regression with robust error variance? …
Subscribe to:
Post Comments (Atom)
0 Response to Counting number of categories in a variable by group
Post a Comment