Hello,
I want to run a command where I have 2 varlist, and want to calculate the mean of variable in first varlist if the respective variable at same position in varlist 2 has observations equal to 1.
This code is giving me an error of "invalid syntax".
I want to run a command where I have 2 varlist, and want to calculate the mean of variable in first varlist if the respective variable at same position in varlist 2 has observations equal to 1.
Code:
local varlist1 a b c local varlist2 d e f foreach var of varlist1 & var2 of varlist2 { tabstat `var', stats(mean), if `var2'==1 }
Comment