Hi,
I want to tabulate or list the distinct or unique values of "stcode" and "avg" variables. The dataex is given below.
bys stcode : egen avg = mean(income)
I want to list the as follows:
+--------------+
| stcode avg |
|--------------|
1. | BR 9 |
2. | KA 16 |
3. | KL 2.5 |
4. | OD 25 |
+--------------+
The above list is generated after dropping the duplicates.
Any advice will be highly appreciated.
Thank you.
I want to tabulate or list the distinct or unique values of "stcode" and "avg" variables. The dataex is given below.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str9 state float(year income) str2 stcode "Kerala" 2016 1 "KL" "Kerala" 2017 2 "KL" "Kerala" 2018 3 "KL" "Kerala" 2019 4 "KL" "Odisha" 2016 10 "OD" "Odisha" 2017 20 "OD" "Odisha" 2018 30 "OD" "Odisha" 2019 40 "OD" "Bihar" 2016 7 "BR" "Bihar" 2017 8 "BR" "Bihar" 2018 10 "BR" "Bihar" 2019 11 "BR" "Karnataka" 2016 5 "KA" "Karnataka" 2017 15 "KA" "Karnataka" 2018 20 "KA" "Karnataka" 2019 24 "KA" end
I want to list the as follows:
+--------------+
| stcode avg |
|--------------|
1. | BR 9 |
2. | KA 16 |
3. | KL 2.5 |
4. | OD 25 |
+--------------+
The above list is generated after dropping the duplicates.
Any advice will be highly appreciated.
Thank you.
Comment