Hi all,
I am trying to add blank space for some specific word (Cost) when exist typo in label var, example of my data:
My goal is insert a blank space before the word: "Cost" in label var that have a wrong label var: cost1, cost2 and cost4.

I tried with:
But only split the var label:

I am trying to add blank space for some specific word (Cost) when exist typo in label var, example of my data:
Code:
clear all input cost1 cost2 cost3 cost4 . . . . end label var cost1 "TotalCost Machinery1" label var cost2 "VarCost Machinery2" label var cost3 "RandomCost Machinery3" label var cost4 "ExternalCost Machinery4"
I tried with:
Code:
foreach var of varlist * { local varlabel : var label `var' local newname = regexr("`varlabel'", "(.)+\Cost", " Cost") label variable `var' "`newname'" }
Comment