Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Save option with forvalues loop and icio command

    Hi everyone,

    I am using the icio command from ssc install in Stata 15.1

    The data is built-in in the command (through using icio_load and specifying the requested input output table database).

    This is an example of how the command looks like:
    icio, origin(country code[,sector code])
    destination(country code [,sector code]) [standard options]


    The options include a save option.

    I am trying to use the following loop with this icio command:
    forvalues i = 3/24 {
    icio, origin(ita,`i') destination(ita,all) save("supply_demand.xls")
    }

    The problem is that the output of i=3 gets saved but afterwards, with the output of i=4 there is an error that the excel file already exists.

    I would be grateful if you could advise on this. I am sorry in advance if this has been asked before and I couldn't locate the answer.

    Many thanks in advance.

    Jala Youssef

  • #2
    The output of help icio tells us about the sub-options to the save() option. Perhaps
    Code:
    icio, origin(ita,`i') destination(ita,all) save("supply_demand.xls", modify sheet("sector`i'")
    Last edited by William Lisowski; 11 Oct 2022, 10:26.

    Comment


    • #3
      Dear William Lisowski

      Thanks a lot for the very useful reply, much appreciated.

      Jala

      Comment

      Working...
      X