Hello,
I am using STATA 15.0 and using .do files we are creating to call on a .ado file to format .csv data appears to be continuously saving..... making it quite slow!
How can I recode my .ado file so it wont do this?
I have spent some hours trying to work on a solution to this via Google and reading masses of examples of code, but am not getting very far.
Appreciate any help you can provide
Andy
.ado code
program define tab2date_to_excel
tabulate `1' `2', matcell(categories) matrow(rows)
cap putexcel set "`3'", modify sheet("`4'")
putexcel A1=("`1'" + " by " + "`2'")
local categories = colsof(categories)
local rows = rowsof(rows)
forvalues j = 1/`categories' {
local col = char(65 + `j')
local row = 2
local running_total = 0
putexcel `col'1=("`j'")
forvalues i = 1/`rows' {
local var1value = string(rows[`i',1],"`5'")
local n = categories[`i',`j']
local running_total = `running_total' + `n'
putexcel A`row'=("`var1value'") `col'`row'=(`n')
local row = `row' + 1
}
putexcel A`row'=("Total") `col'`row'=(`running_total')
}
end
I am using STATA 15.0 and using .do files we are creating to call on a .ado file to format .csv data appears to be continuously saving..... making it quite slow!
How can I recode my .ado file so it wont do this?
I have spent some hours trying to work on a solution to this via Google and reading masses of examples of code, but am not getting very far.
Appreciate any help you can provide
Andy
.ado code
program define tab2date_to_excel
tabulate `1' `2', matcell(categories) matrow(rows)
cap putexcel set "`3'", modify sheet("`4'")
putexcel A1=("`1'" + " by " + "`2'")
local categories = colsof(categories)
local rows = rowsof(rows)
forvalues j = 1/`categories' {
local col = char(65 + `j')
local row = 2
local running_total = 0
putexcel `col'1=("`j'")
forvalues i = 1/`rows' {
local var1value = string(rows[`i',1],"`5'")
local n = categories[`i',`j']
local running_total = `running_total' + `n'
putexcel A`row'=("`var1value'") `col'`row'=(`n')
local row = `row' + 1
}
putexcel A`row'=("Total") `col'`row'=(`running_total')
}
end
Comment