IS there a function to change letters at a given index in SAS?
For example if my string is
string1 = 'abcd1234efgh'
I want to do somehing like:
string2 = somefunction(string1, 5, 'zzzz');
to produce
'abcdzzzzefgh'
Yes, substr() = is what you're looking for. See here for details.
substr(string2, 5) = 'zzzz';
The substr(variable,position<,length>) = function can also take an third argument to define the length of the segment to be replaced.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With