Trying to assess the variation of the NUMBER of different type of cars used by high vs low income people. I do not have a threshold of what is accetable and what isn't. For eg perhaps high income will use just 1 car vs low income who more commonly will use 3 cars
Therefore I first, For each ID person, I would like to calculate the total number different cars used . I used the following, which gave me an error:
dataset set:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(type car_model id volvo fiat mercedes renault) 1 1 12 1 0 0 0 1 1 12 1 0 0 0 1 2 17 0 1 0 0 2 1 16 1 0 0 0 2 2 19 0 1 0 0 2 3 20 0 0 1 0 2 4 21 0 0 0 1 end label values type m label def m 1 "high income", modify label def m 2 "low income", modify label values car_model q label def q 1 "volvo", modify label def q 2 "fiat", modify label def q 3 "mercedes", modify label def q 4 "renault", modify
Code:
egen total_used = total(volvo fiat mercedes renault), by(id)
//egen total_used = count(volvo fiat mercedes renault), by(id)
volvofiatmercedesrenault not found
r(111);
I would like to then do the following - any recommendations/advice welcome
Code:
tab type, sum(total_used) regress total_used i.type
Comment