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
Cox regression assumptionI am doing a research to examine the association between sleep and all-cause mortality. The average …
SEM, error coefficients output.Hi, How can I receive the outputs for the "path coefficient" of error terms to each items of a laten…
how to get x-standardized coefficient in logistic regression, i.e., reproduce results from "listcoef" commandI was trying to get the standardized coefficient from ologit model. "listcoef" can produce the table…
How to filter dates within an interval from a set of observationHello, i have a dataset of around 900,000 observations from about 130,000 ids. The variables i am w…
reshape - wide connectionsI have variables in wide that belong together i groups (eg. var1a and var2a). I would like to reshap…
Subscribe to:
Post Comments (Atom)
0 Response to Efficient Way to Reform Repeated Codes with IF condition
Post a Comment