Hi! I got this code that allows me to export a simple tabulation of the variable "Edad" to Excel:

tabulate Edad, matcell(freq) matrow(names)

putexcel set "Example 1", modify
putexcel A1=("Pregunta 1") B1=("Frecuencia") C1=("%") D1=("% Acumulado")

local rows = rowsof(names)
local row = 2
local cum_percent = 0

forvalues i = 1/`rows' {

local val = names[`i',1]
local val_lab : label (Edad) `val'

local freq_val = freq[`i',1]

local percent_val = `freq_val'/`r(N)'*100
local percent_val : display %9.2f `percent_val'

local cum_percent : display %9.2f (`cum_percent' + `percent_val')

putexcel A`row'=("`val_lab'") B`row'=(`freq_val') C`row'=(`percent_val') ///
D`row'=(`cum_percent')
local row = `row' + 1
}

putexcel A`row'=("Total") B`row'=(r(N)) C`row'=(100.00)


It works perfectly, the things is that I want to do this same procedure but for the other 35 variables that I have, and also it would be great if I could export the tables in the same Excel file or even the same spreadsheet. I could run the comand 35 five times changing the name of the variable but there must be an easier way to do this, can you point me in the right direction or give me advice on how to proceed?

Thank you very much!