Hi, this is my first post in the forum, I hope I will do this correctly. I am using Stata 15.1
I have som regression results and graphs that I am pasting to Excel using putexcel.
The data will be put into the spreadsheet on different columns, and I am using local macros to store the column numbers. The number of columns in the spreadsheet is around 100. I was wondering if it possible to assign names to local macros using another macro? This is what I am doing now, and it is generating a lot of code and a lot of lines:
local col = 1
excelcol `col'
local c1 = r(column)
local col = `col' + 1
excelcol `col'
local c2 = r(column)
local col = `col' + 2
excelcol `col'
local c3 = r(column)
It would shorten things up if I could do something like this:
forval i=1/100 {
local col = "ì'"
excelcol col
local c"`i'" = col /* creating macros named c1, c2....c100 */
}
But I get all sorts of messages about unrecognized namem regarding on how I put the quotation marks in the statement "local c"`i'" ="
Is this possible at all?
Thank you all for a great forum!
Related Posts with Creating local macro names using a loop
Models that allows quantitative and qualitative variablesIn a rural household’s survey, I am working with Diff. I have work with dummies for some topics such…
Problem with Forest plot using midasHi everyone, I am using midas to do diagnostic accuracy meta-analysis. I have one relatively simple…
Inter-rater agreement for a large nested survey dataHi all, I am running into an issue dealing with generateng inter-rater agreement for a nested survey…
Distribution of FEHello everyone. I am trying to get the distribution of firm fixed effects (acquirer FE) when I also…
C plugin argumentsStataers, I wrote a C plugin that I can call using this code: Code: program r preserve versio…
Subscribe to:
Post Comments (Atom)
0 Response to Creating local macro names using a loop
Post a Comment