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
Stata triple interaction and base categoryI have four variables: panid (id variable), period (categorical going from 0 to 2), size (categorica…
Finding whether value of one string variable appear in anotherHi, With the dataset similar to the one listed below, I am trying to find whether main_var contains…
generating N dummies for each value in variableGood morning, I need to generate a categorical variable for each of these entries: Code: numb…
Panel data: per country charts in one single graphDear all, I am struggling a bit to reproduce a panel data chart. Let's say that I have three variab…
Panel Data - Development of the mean of a variable by year and industry / by year and countryI have panel data and want to create a table that shows the development of the variable digital term…
Subscribe to:
Post Comments (Atom)
0 Response to Creating local macro names using a loop
Post a Comment