Hello there,
I have a question concerning my data set. I want to find out the total distribution of values which occur in multiple variables.
My sample is structured as the following:
A participant can have up to 4 different roles, which are represented in 4 different variables (RC1 (rolecode1) RC2 RC3 RC4). In addition, the participant can choose his position from 30 different rolecodes (e.g. Secretary, President, Vice President and so on). These values can also change from year to year, depending on changes of employment / promotion.
Therefore the dataset looks something like this:
participantid year RC1 RC2 RC3 RC4
1 2017 S VP P .
1 2018 S P . .
1 2019 S P . .
2 2017 CB EVP P D
2 2018 CB EVP P .
2 2019 CEO D . .
Now my problem is that I can look at the distribution of only 1 varibale by using: tabulate rolecode1
But I don't know how I can find out the total distribution of for example the rolecode "P" in the entire dataset. In my short example for rolecode2 it would be 0.4, for rolecode3 it would be 1 and for the entire example it would be 0.3125.
Does anybody have an idea how I can create an overview like the command 'tabulate' does, but for the distribution of all rolecodes in the 4 distinctive variables?
Like this:
Rolecodes Frequency Percent
S 3 0.1875
CB 2 0.125
CEO 1 0,0625
VP 1 0.0625
P 5 0.3125
EVP 2 0.125
D 2 0.125
Your help is very much appreciated.
Related Posts with Distribution of values among multiple variables
Unable to reshape multiply imputed dataHello, I am unable to reshape my data into long format to run a fixed effects model. As can be seen…
osample command teffects IPWRAI am using IPWRA and have tried to use osample to identify the overlap violation but am getting a co…
Exporting of Stata Graphs as .pngI am using Stata/IC 14.2 for Windows (64-bit). I am also using Windows 10 I have a long .do file whe…
Generating a new numeric variable that gives the proportion of a value count and the total count of anotherHello Statalist, I'm working with an integer variable "ind" (for industry) and a 0-1 binary float v…
Combining observations under specific conditionsDear stata-users, I'm trying to combine observations under some conditions. Specifically, I have di…
Subscribe to:
Post Comments (Atom)
0 Response to Distribution of values among multiple variables
Post a Comment