I have a for loop to put variable names and variable labels in A1 and B1 cells respectively. For some reason about 1% of my variables return an error.
the error is
The variables causing the errors have open parentheses, but no closed parentheses. THis is happening because I am importing data from an SPSS file and STATA's variable labels are capped at 80 characters.
I have two ideas on how I may be able to solve the problem. Ideally I would love to increase stata's variable label character limit. I think adding a closed parentheses to all the strings might fix it, but it also might cause new errors. I have had trouble using the char() function. I think it is due to not understanding which kind of quotes to put it in.
Code:
foreach var in `varlist'{ local varlabel : variable label `var' putexcel A1=("`var'") B1=("`varlabel'") using "tabulations2 `c(current_date)'", modify sheet("`var'") }
the error is
errprintf(): 3001 incorrect number of arguments
putexcel_check_paren(): - function returned error
putexcel_is_exp(): - function returned error
putexcel_get_exp_info(): - function returned error
putexcel_add_cellexplist(): - function returned error
putexcel_parse_cellexplist(): - function returned error
putexcel_parse_syntax(): - function returned error
putexcel(): - function returned error
<istmt>: - function returned error
putexcel_check_paren(): - function returned error
putexcel_is_exp(): - function returned error
putexcel_get_exp_info(): - function returned error
putexcel_add_cellexplist(): - function returned error
putexcel_parse_cellexplist(): - function returned error
putexcel_parse_syntax(): - function returned error
putexcel(): - function returned error
<istmt>: - function returned error
I have two ideas on how I may be able to solve the problem. Ideally I would love to increase stata's variable label character limit. I think adding a closed parentheses to all the strings might fix it, but it also might cause new errors. I have had trouble using the char() function. I think it is due to not understanding which kind of quotes to put it in.
Comment