I'm sure this is somewhat simple but haven't been able to wrap my head around it, so here it goes:
How to segment the following example of a macro
"x1 x2 x3 x4 y1 y2 y3 y4 z1 z2 z3 z4"
into the following macros
"x1 x2 x3 x4"
"y1 y2 y3 y4"
"z1 z2 z3 z4"
------
Additionally, can you set a macro name in relation to the value of another one?
Ex: say I have
local counter_i: "98".
Can I generate a macro called year_98 by referencing it to `counter_i'?
Have tried to so by coding local year_`counter_1' --as I would do, for example, to name a variable, But stata keeps telling me that is an invalid syntax.
Thanks in advance for your help, and apologize in advance for any lack of technicalities or ambiguities in my terminology.
Best,
Sergio.
Related Posts with Dividing a macro into segments of equal number of elements.
xtreg fe versus areg robust errors?Hello! I apologize if some of the questions in this post seem simple, but this has to do with my the…
Selecting 3 controls per caseHello everyone. I know a couple of topics have covered this but I can't seem to figure out how to se…
test runHello! I apologize if some of the questions in this post seem simple, but this has to do with my the…
practicing Code: xtreg zscore lnasset lnassetsq diverse leverage eeffqr DGS10 CPIAUCSL_PCH GDPC1_PC1, fe Fixe…
Read a list of variables in a loop, while ignoring some variables that don't existHello, I'm trying to use a list of variables that have suffixes based on years, using a loop. Howev…
Subscribe to:
Post Comments (Atom)
0 Response to Dividing a macro into segments of equal number of elements.
Post a Comment