Hello statalist I want to make a descriptive analysis using my dataset. I have 7 independent variables and 1 independent variable called “politisering”. I want to count the total number of observations per year for each independent variable = 1 as a percentage if that variable has the value 1 on my dependent variable “politisering”.
Example: Say for the year 2000 I have a total 40 observations for my independent variable “kontorchef” = 1. Of those 40 observations, 10 have the value 1 on “politisering”. I then want to calculate the percentage of that and in a new variable.
I want to do this for each year with each variable, so that there is only 1 observation per variable per year. Can anyone help me out with what command I should use?
Any advice is much appreciated!
I have the following dataset:
Example: Say for the year 2000 I have a total 40 observations for my independent variable “kontorchef” = 1. Of those 40 observations, 10 have the value 1 on “politisering”. I then want to calculate the percentage of that and in a new variable.
I want to do this for each year with each variable, so that there is only 1 observation per variable per year. Can anyone help me out with what command I should use?
Any advice is much appreciated!
I have the following dataset:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int år byte(fuldmægtig kontorchef afdelingschef departementschef koordinerende velfærd politisering) 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 0 0 0 0 0 0 0 1982 0 1 0 0 0 0 0 1982 0 0 1 0 0 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 1 0 0 0 1 0 0 1982 0 1 0 0 1 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 1 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 0 0 1982 1 0 0 0 0 1 0 1983 1 0 0 0 0 0 0 1983 1 0 0 0 0 0 0 1983 1 0 0 0 0 0 0 1983 1 0 0 0 0 0 0 1983 1 0 0 0 0 1 0 1983 1 0 0 0 0 0 0 1983 1 0 0 0 0 1 0 1983 1 0 0 0 0 1 0 1983 1 0 0 0 0 1 0 1983 1 0 0 0 0 1 0 1983 1 0 0 0 0 0 0 1983 1 0 0 0 0 0 0 end

Comment