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
Data Analyst, Research Job Opening - Center for Community Health, Northwestern UnviersityWorking in the Center for Community Health in Northwestern University’s Institute of Public Health, …
Difference-in-difference fixed effects with multiple periodsDear all, I am trying to run a difference-in-difference fixed-effects model. The challenge here is …
frame post not working after last updateHas anyone else noticed their code using frame post is now not working? I had code like below that w…
Unit Root CircleHi guys, I am currently doing a task, I am not really familiar with and I do need your help. It sa…
Using psmatch2 for panel dataDear Statalisters, I am using balanced panel data where the panel variable is country and the time v…
Subscribe to:
Post Comments (Atom)
0 Response to Efficient Way to Reform Repeated Codes with IF condition
Post a Comment