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
Dropping all but the highest value per individual, multiple recordsHi Statalist colleagues! Thanks to your previous help, I was able to create an indicator variable f…
Trouble configuring use of whereis with Word for Mac and markstat in Stata 16Hello all, I very happily developed a .do file on a Windows 10 machine using markstat with pandoc a…
Using Mata*Inside Stata Program LoopHello, I am attempting to write a Stata/Mata program which formats excel files using Mata, by loopi…
Calculating CAAR (Event Study)Hello, I am trying to calculate a variety of CAARs for my dataset. I already have calculated the ave…
Replacing pieces of code with one lineIs there a code with which i can replace certain areas of a larger code while only one line For exa…
Subscribe to:
Post Comments (Atom)
0 Response to Create a new variable that shows the result of tabulation
Post a Comment