I encounter two interesting functions today and want to find out what they do:
1) I found it here : This can remove leading 0s from a string. But what does "+//o" do in y =prxchange('s/^0+//o',-1,x)?
data val;
x='000asd1234';output;
x='123'; output;
x='0009876'; output;
run;
data nozero;
set val;
y =prxchange('s/^0+//o',-1,x);
run;
I wanted to remove leading dashes, and it works by replacing 0 to -, but I still do not understand it well.
data val;
x='-000asd1234';output;
x='1-23'; output;
x='0009-876'; output;
run;
data nozero;
set val;
y =prxchange('s/^-+//o',-1,x);
run;
2. Another function if anyalpha:
if anyalpha(string) then string='';
anyalpha(string) will return 0 if there is no alphabeta found, or first position of an alphabeta character. In the above code, does
if anyalpha(string)
is the same as
if anyalpha(string) >0
? i.e. if string contains any alphabeta characters, then set it to missing?
... View more