Hi folks,
Is there any simple way to convert a string to octal notation? For example:
origina string: "mó test"
expected string: "m\363 test"
I tried to use KPROPDATA function, but it returns in UTF or latin. I can't find how to define octal notation.
Regards,
KPROPDATA("&diretorio.",'UESC','utf8'));
You can use $OCTALw. Format to do just that. For example, the following code:
data _null_;
c = 'ó';
c_oct = put(c, $octal.);
put c= / c_oct=;
run;
will produce:
c=ó
c_oct=363
Hope this helps.
Hi MariaD,
Do you want to convert to octal the whole string (as formulated in your question) or just a specific character (as shown in your example)? Please clarify.
You can use $OCTALw. Format to do just that. For example, the following code:
data _null_;
c = 'ó';
c_oct = put(c, $octal.);
put c= / c_oct=;
run;
will produce:
c=ó
c_oct=363
Hope this helps.
Thanks @LeonidBatkhan
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.