Everything is working perfectly for the export. I kept working at it yesterday and realised my error. You have confirmed it here. There are so many small things to remember, I guess it will just take time, practice and experience. Must stick at it!
My code is now working fine from an export perspective:
However, the values it is calculating for Sum of Squares (SS), Degrees of Freedom (DF) are zero and Mean of Squares (MS) is "."
Is this because of the way that I have the syntax? In the non-macro version of what I am wanting to achieve, that doesnt include excel output, being:
The results are fine.
Should I be using a command other than regress in the macro?
The full code I am now trying to run looks like:
The results for mean and standard deviation are the same in both the non-macro version of the code and the macro version which excludes the excel output. However the SS, DF and MS are not.
Do you have any insights you wouldnt mind sharing?
thanks as always,
Mel
My code is now working fine from an export perspective:
Code:
putexcel H1=("F") I1=("DF1") J1=("DF2") loc row = 2 foreach x of varlist wk3_zwei { forvalues id = 0/2 { forvalues me = 0/2 { regress `x' if MothersEthnicity==`me' & Infant_diplo==`id' putexcel H`row' = (e(F)) I`row' = (e(df_m)) J`row' = (e(df_r)) loc row = `row' + 1 } } }
However, the values it is calculating for Sum of Squares (SS), Degrees of Freedom (DF) are zero and Mean of Squares (MS) is "."
Is this because of the way that I have the syntax? In the non-macro version of what I am wanting to achieve, that doesnt include excel output, being:
Code:
sort Infant_diplo by Infant_diplo : oneway wk3_zwei MothersEthnicity_Nu , tabulate
Should I be using a command other than regress in the macro?
The full code I am now trying to run looks like:
Code:
putexcel set "FileName", sheet ("ANOVA")modify putexcel A1=("Variable") B1 = ("Mean") C1=("SD") local row = 2 foreach x of varlist wk3_zwei { forvalues id = 0/2 { forvalues me = 0/2 { summarize `x' if MothersEthnicity==`me' & Infant_diplo==`id' putexcel A`row' = ("`x'") B`row' = (r(mean)) C`row' = (r(sd)) loc row = `row' + 1 } } } putexcel H1=("F") I1=("DF1") J1=("DF2") loc row = 2 foreach x of varlist wk3_zwei { forvalues id = 0/2 { forvalues me = 0/2 { regress `x' if MothersEthnicity==`me' & Infant_diplo==`id' putexcel H`row' = (e(F)) I`row' = (e(df_m)) J`row' = (e(df_r)) loc row = `row' + 1 } } }
The results for mean and standard deviation are the same in both the non-macro version of the code and the macro version which excludes the excel output. However the SS, DF and MS are not.
Do you have any insights you wouldnt mind sharing?
thanks as always,
Mel
Comment