Hi all and thanks in advance for your help,
I'm just getting back into Stata and have what I hope is an easy question to answer for you veterans (I've looked around in the archives and couldn't find anything that addresses this type of situation).
I am trying to multiply two local macros and generate new variables for each interaction. For clarity, saleq contains the quantity sold for each product and the corresponding selling value is contained in salev. I was thinking something like what I have below with a couple example variables built into the macros would do the trick, while naming each of the newly generated variables with the suffix inc added to the basename from saleq.
Any insights on how to do this would be much appreciated.
I'm just getting back into Stata and have what I hope is an easy question to answer for you veterans (I've looked around in the archives and couldn't find anything that addresses this type of situation).
I am trying to multiply two local macros and generate new variables for each interaction. For clarity, saleq contains the quantity sold for each product and the corresponding selling value is contained in salev. I was thinking something like what I have below with a couple example variables built into the macros would do the trick, while naming each of the newly generated variables with the suffix inc added to the basename from saleq.
Code:
local saleq ibks ibms iirs inos local salev ibksv ibmsv iirsv inosv quietly foreach v of `saleq' { foreach z of `salev' { gen `v'inc = `v' * `z' } }
Comment