It is impossible to code from pictures. So let's use the values you put into your question body instead.
Construction -industrial
Construction - Industrial
- Do you also want to insert that space after the hyphen?
- What if there is already a space after the hyphen? Do you want to find the next non-space,non-hyphen character and upcase that?
- Is it possible your text has non-ASCII characters, like an endash or emdash, instead of a hyphen. Do you need to find those also?
So assuming that the hyphen is immediately in front of the character to upcase you could try something like this:
data want;
set have;
loc=-1;
do until(loc=0);
loc=findc(string,'-',loc+2);
if loc then substr(string,loc+1,1)=upcase(char(string,loc+1));
end;
run;
Which is almost exactly like the first example in the FINDC() documentation.
Not hard to adjust to skip over spaces after the hyphen.
data want;
set have;
loc=0;
do until(loc=0);
loc=findc(string,'-',loc+1);
if loc then loc=findc(string,'- ',loc+1,'k');
if loc then substr(string,loc,1)=upcase(char(string,loc));
end;
run;