Dear experts,
For the following repeated codes :
tab1 variable1 if (variableA == 1) & (variableB== 1), missing
tab1 variable1 if (variableA == 1) & (variableB== 1) & (variableC== 1), missing
tab1 variable1 if (variableA == 1) & (variableB== 1) & (variableD== “no reason”), missing
tab1 variable2 if (variableA == 1) & (variableB== 1), missing
tab1 variable2 if (variableA == 1) & (variableB== 1) & (variableC== 1), missing
tab1 variable2 if (variableA == 1) & (variableB== 1) & (variableD== “no reason”), missing
tab1 variable3 if (variableA == 1) & (variableB== 1), missing
tab1 variable3 if (variableA == 1) & (variableB== 1) & (variableC== 1), missing
tab1 variable3 if (variableA == 1) & (variableB== 1) & (variableD== “no reason”), missing
…….
…….
If I repeat doing the same above for variable1, variable2, variable3……variable6
Other than using macro below, is there any more efficient way? e.g. using loop?
Thank you for help.
local repeat variable1 variable2 variable3 variable4 variable5 variable6
tab1 `repeat’ if (variableA == 1) & (variableB== 1), missing
tab1 `repeat’ if (variableA == 1) & (variableB== 1) & (variableC== 1), missing
tab1 `repeat’ if (variableA == 1) & (variableB== 1) & (variableD== “no reason”), missing
Related Posts with Efficient Way to Reform Repeated Codes with IF condition
graph editor vs commandhi together i have following graph by command a b c d e 96 16 43 34 16 graph hbar (sum) a b c…
how to draw a plot with confidence interval non-parametric regHi, I am using npregress kernel code for my analysis which goes like this: npregress kernel DepVar…
Computing Z-Score (risk measure)Hi guys, I´m new here and have just startet do use STATA for my thesis. So basically I´m interested…
Unit root in panel dataDear Statalist, Question: if I have a number of variables and only some of them contain unit root …
Add missing date, last observationHi, I do have an issue with my dataset. I need to add missing dates and replace the variable "creat…
Subscribe to:
Post Comments (Atom)
0 Response to Efficient Way to Reform Repeated Codes with IF condition
Post a Comment