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
Help needed: Extracting data from different rowsHi all, I need some help in extracting data from a column. I am trying to find a way to do so witho…
Epidemiology analysisplease helm me with this case I dont know the syntax the data is on the attachment Estimate regress…
Mediation suregDear all, I am running the follwing STATA code from the example from this website: https://stats.id…
OLS Regression with lagsHey! I am writing my bachelor thesis, studying the relationship between monetary policy and housing…
Pesaran TestHi guys, I am running a fixed effects regression and wanted to test for cross-sectional dependence. …
Subscribe to:
Post Comments (Atom)
0 Response to Creating local macro names using a loop
Post a Comment