Hi experts,
I'm using tranwrd in sas enterprice guide and works fine, but when i use it in the linux environment it does not work
data ALTAS_DEF;
set ALTAS_DEF;
First_name = tranwrd(First_name, 'ñ', 'n');
run;
i just want to change a letter for other one, do you know a work around about it ? or an equivalent function ?
If you only need to change a character ,NOT a word/string, try KTRANSLATE().
data s;
set sashelp.class;
First_name = ktranslate(name, 'n','ñ');
run;
For all your accented letters:
data EXAMPLE ;
%* Test string;
STR1 = 'aaâäÊÉŒñbb';
%* Single letter replacements;
STR2 = ktranslate( STR1
, 'AAAAAACEEEEIIIIDNOOOOOOUUUUYaaaaaaceeeeiiiidnoooooouuuuyy'
, 'ÀÁÂÃÅÄÇÈÉÊËÌÍÎÏÐÑÒÓÔÕØÖÙÚÛÜÝàáâãåäçèéêëìíîïðñòóôõøöùúûüýÿ' );
%* Double letter replacements;
STR3 = tranwrd ( STR2, 'Æ', 'AE' );
STR3 = tranwrd ( STR3, 'æ', 'ae' );
STR3 = tranwrd ( STR3, 'Œ', 'OE' );
STR3 = tranwrd ( STR3, 'œ', 'oe' );
STR3 = tranwrd ( STR3, 'ß', 'ss' );
run;
SAS does not support the regular expression syntax needed to do this in one.
I'm using tranwrd in sas enterprice guide and works fine, but when i use it in the linux environment it does not work
This makes no sense. The SAS language is the very same on all platforms. I suspect you have another issue, like encoding.
Run this to verify:
%put &=sysencoding;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: