Hello Statalist,
I consider myself a beginner, so I would appreciate your help, and thank you for this learning opportunity.
out of 800 observations, I am interested to tabulate 3 variables:
1- "biz" : which is patient id
2- "status" : which is categorical with two level= surgery and not-surgery
3- "quality" : which is categorical with two level= fail and pass
I am interested to create a new variable (let's call it percent), which has the percentage of "pass" for each biz & status.
So far I use these two commands separately, but they are not giving me what I am interested in:
. by biz status, sort: tab quality
. forvalues i=1/40 {
asdoc tab2 status qm_1 if biz==`i', append col nof save(asa)
}
They show the tabulation tables with percent fail&pass, but I don't know how to transform the percent pass as a new variable to my data set.
Again, I appreciate your help.
Best,
Mahmoud
Related Posts with Create a new variable that shows the result of tabulation
add one variable from one dataset to another one: error variable V2 does not uniquely identify observations in the master dataHell everyone, I have a dataset with V2 - country code (in the codebook each country has a code so…
Make an exception within a loopI'm using version 15 of stata, and I'm wondering if it is possible to make an exception within a loo…
Adding prefix to all observations in columnI have a column of identifiers which are e.g. : 58473J 50046Q 22631J I would like to add a prefix …
Instrumental Variable method for binary dependant variable and binary instrument and binary endogenous variableHi, What model should I use? Currently, my model looks like this:ivregress 2sls depressed L.formal…
Individual time span reference per observationDear community, I have a dataset with about 3 million observations. Each observation has a time id,…
Subscribe to:
Post Comments (Atom)
0 Response to Create a new variable that shows the result of tabulation
Post a Comment