The code below is too long for me.I know it could be replaced by a foreach loop,but I don't know how to write the loop。Could anyone tell me the simplified version or some books where I can learn more?
Code:
local class1 "var1 var2" local class2 "var3 var4" local class3 "var5 var6" local class4 "var7 var8" local class5 "var9 var10" local class6 "var11 var12" egen rnmofclass1=rownonmiss(`class1') lab var rnmofclass1 "the number of nonmissing values in class1" egen rnmofclass2=rownonmiss(`class2') lab var rnmofclass2 "the number of nonmissing values in class2" egen rnmofclass3=rownonmiss(`class3') lab var rnmofclass3 "the number of nonmissing values in class3" egen rnmofclass4=rownonmiss(`class4') lab var rnmofclass4 "the number of nonmissing values in class4" egen rnmofclass5=rownonmiss(`class5') lab var rnmofclass5 "the number of nonmissing values in class5" egen rnmofclass6=rownonmiss(`class6') lab var rnmofclass6 "the number of nonmissing values in class6"
0 Response to foreach loop and local
Post a Comment