I'm trying to determine the best way to run the same code multiple times through different variables.
I have 3 variables that I want to work with (in a variable list type situation).
yvar which my y-variable
tvar which is a number associated with my y-scale
nvar which is a string and is the title of the graph on the output.
My code looks like this:
examples would be:
yvar DRS_Score CHESS_Score PAIN_Score
tvar 13 5 3
nvar Depression CHESS Pain (These are string values for the title)
I want it to run through the first time using DRS_Score as the yvar, 13 as the tvar and Depression (a string) as the nvar, then again using CHESS_Score 5 CHESS, and again using PAIN_Score 3 Pain
From what I've gathered from the manual and a few powerpoints I've found online I can't do this with loop because I can only assign one foreach value per loop (I don't know if this is actually correct it's what I've gathered from resources I've looked at).
For local macros when I run it it seems to put the yvar as all my variables together instead of running it as a loop (using: local yvar DRS_Score CHESS_Score PAIN_Score I tried using $yvar in the code when using local and `yvar' when using loop).
I also am not sure if what I want to do with nvar is even possible (to insert a variable name into a title).
Any guidance is greatly appreciated
I have 3 variables that I want to work with (in a variable list type situation).
yvar which my y-variable
tvar which is a number associated with my y-scale
nvar which is a string and is the title of the graph on the output.
My code looks like this:
Code:
anova yvar Sex_AA2 Pre_LTCH Sex_AA2#Pre_LTCH / /// unique_ID|Pre_LTCH#Sex_AA2 /// data_point /// data_point#Sex_AA2 data_point#Pre_LTCH /// data_point#Sex_AA2#Pre_LTCH /// if Sex_AA2!=2, /// rep(data_point) margins, over(Pre_LTCH Sex_AA2 data_point) marginsplot, xdim(data_point) ylabel(0 tvar) ytick(0(1)tvar) graphregion(margin(5 20 10 5)) title("Predictive Margins for nvar") xtitle("Time point") ytitle("Adjusted Prediction (0-tvar)")
yvar DRS_Score CHESS_Score PAIN_Score
tvar 13 5 3
nvar Depression CHESS Pain (These are string values for the title)
I want it to run through the first time using DRS_Score as the yvar, 13 as the tvar and Depression (a string) as the nvar, then again using CHESS_Score 5 CHESS, and again using PAIN_Score 3 Pain
From what I've gathered from the manual and a few powerpoints I've found online I can't do this with loop because I can only assign one foreach value per loop (I don't know if this is actually correct it's what I've gathered from resources I've looked at).
For local macros when I run it it seems to put the yvar as all my variables together instead of running it as a loop (using: local yvar DRS_Score CHESS_Score PAIN_Score I tried using $yvar in the code when using local and `yvar' when using loop).
I also am not sure if what I want to do with nvar is even possible (to insert a variable name into a title).
Any guidance is greatly appreciated
Comment