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
CFC_SAS_Communities_400x225.jpg
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.