I am trying to clean up variable labels - removing spaces and punctuation - in anticipation of turning them into variable names.
When I try to remove single quotes using the following code, I get an error of "too few quotes" and "invalid syntax". Any advice/assistance would be so helpful
Best,
Erika
When I try to remove single quotes using the following code, I get an error of "too few quotes" and "invalid syntax". Any advice/assistance would be so helpful
Code:
foreach var of varlist * { local lab `: var label `var'' if length("`lab'") > 80 { local lab `: di substr("`lab'", 1, 79)' } local lab `: di subinstr("`lab'", "%", "Pct",.)' local lab `: di subinstr("`lab'", "'", "",.)' local lab `: di subinstr("`lab'", ":", "",.)' label var `var' "`lab'" }
Erika
Comment