Hello ,
I have an issue can someone help me.
I have a colonne value like this :
var ="USERNUM1, Counter{F}Compteur ,
USERTEXT1, Trigram{F}Trigramme ,ALL~All{F}Tous GBR~GBR{F}GBR ITA~ITA{F}ITA"
Notice that after the commaas, i have tabulate.
how can i have as result :
var = "USERNUM1,Counter{F}Compteur,USERTEXT1,Trigram{F}Trigramme,ALL~All{F}Tous GBR~GBR{F}GBR ITA~ITA{F}ITA"
It looks to me that the compress() function s modifier should remove the characters you don't want.
newar=compress(var,,'s');
s or S adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, form feed, and NBSP ('A0'x, or 160 decimal ASCII) to the list of characters.
See if this works to remove tab characters for you:
data test; set yourdatsetname; newvar = compress(var,,'h'); run;
The two commas in the parameters for the Compress function means you are not supply a character to remove by typing it. The 'h' adds the horizontal tab character to the list of characters to remove, so the above should only remove horizontal tab characters.
Also try to remove the newline characters.
data test;
set yourdatsetname;
newvar = compress(var,'0D0A'x,'s');
run;
It looks to me that the compress() function s modifier should remove the characters you don't want.
newar=compress(var,,'s');
s or S adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, form feed, and NBSP ('A0'x, or 160 decimal ASCII) to the list of characters.
Thks so much
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.