Hello,
This is my first time posting on Statalist and I am looking for some help with code. I am using Stata 17.0 on Windows.
I have a dataset where I would like to count for each country (hv000), the total number of IDs (team2), that have a certain characteristic (whz==0).
In the dataset
This is my first time posting on Statalist and I am looking for some help with code. I am using Stata 17.0 on Windows.
I have a dataset where I would like to count for each country (hv000), the total number of IDs (team2), that have a certain characteristic (whz==0).
In the dataset
- whz is a binary variable 1/0
- the team IDs are not unique to each country and the number of teams per country vary
- there are some observations where the characteristic is missing, but for my purposes I can ignore missing
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str4 hv000 float(team2 whz) "ET7a" 1502 0 "ET7a" 3302 0 "ET7a" 2002 0 "ET7a" 2602 0 "ET7a" 402 0 "ET7a" 1902 . "SN6a" 916 . "SN6a" 914 0 "SN6a" 904 0 "SN6b" 20 0 "SN6c" 10 0 "SN6c" 30 0 "SN6d" 20 0 "SN6d" 20 0 "SN7a" 100 0 "SN7a" 170 0 "SN7a" 100 0 "SN7a" 110 0 "SN7b" 120 0 "SN7b" 120 0 end