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
putdocx with multi-level modelsIs there a way to export the both the coefficient table as well as the random-effects parameters tab…
add double quotes to valuesSomeone asked how to remove double quotes from a string, but I want to add double quotes to string v…
Table 2 Presenting Findings Chi2 TableMy team is looking to program publishing quality Table 2 placed into a word document with APA format…
Question about contrast and marginDear scientist, If I want to compare the mean of different variable levels between two groups, afte…
Diff in Diff with matchingDear Statalisters, I’m working with panel data that contains observations for 8000 firms for the pe…
Subscribe to:
Post Comments (Atom)
0 Response to Creating local macro names using a loop
Post a Comment