Dear,
I am using the code (Table) to summarize the Survey MEAN of over 50 variables (each variable has 8 rows labeled Canadian provinces) and calculate Chi-squared tests for each province in each variable.
I would like to further loop this process, and (most importantly) write a code that will loop and store all the results of the SVY and TEST functions in to a matrix.
Table: my code
*F-Test: (F-test compare each province to the other for each 'n' variable)
foreach x of varlist nq*_a{
svy: mean `x', over (qprov)
test [`x']_subpop_1 =[`x']Alberta
test [`x']_subpop_1 =[`x']Saskatchewan
test [`x']_subpop_1 =[`x']Manitoba
test [`x']_subpop_1 =[`x']Ontario
test [`x']_subpop_1 =[`x']Quebec
test [`x']_subpop_1 =[`x']Atlantic
test [`x']_subpop_1 =[`x']North
test [`x']Alberta =[`x']_subpop_1
test [`x']Alberta =[`x']Saskatchewan
test [`x']Alberta =[`x']Manitoba
test [`x']Alberta =[`x']Ontario
test [`x']Alberta =[`x']Quebec
test [`x']Alberta =[`x']Atlantic
test [`x']Alberta =[`x']North
*continues for each province (_subpop_1=BC)
}
I am quite primitive in Stata and new to this forum. Please kindly advise and thank you very much!
I am using the code (Table) to summarize the Survey MEAN of over 50 variables (each variable has 8 rows labeled Canadian provinces) and calculate Chi-squared tests for each province in each variable.
I would like to further loop this process, and (most importantly) write a code that will loop and store all the results of the SVY and TEST functions in to a matrix.
Table: my code
*F-Test: (F-test compare each province to the other for each 'n' variable)
foreach x of varlist nq*_a{
svy: mean `x', over (qprov)
test [`x']_subpop_1 =[`x']Alberta
test [`x']_subpop_1 =[`x']Saskatchewan
test [`x']_subpop_1 =[`x']Manitoba
test [`x']_subpop_1 =[`x']Ontario
test [`x']_subpop_1 =[`x']Quebec
test [`x']_subpop_1 =[`x']Atlantic
test [`x']_subpop_1 =[`x']North
test [`x']Alberta =[`x']_subpop_1
test [`x']Alberta =[`x']Saskatchewan
test [`x']Alberta =[`x']Manitoba
test [`x']Alberta =[`x']Ontario
test [`x']Alberta =[`x']Quebec
test [`x']Alberta =[`x']Atlantic
test [`x']Alberta =[`x']North
*continues for each province (_subpop_1=BC)
}
I am quite primitive in Stata and new to this forum. Please kindly advise and thank you very much!