SAS Solved Problems
Monday, 12 February 2018
/
*
extract
last 3 char values in a string*/
ex1:
data ram;
set sashelp.class;
string=substr(name,length(name)-2);
run;
ex2:
data have;
input number $;
var = substr(number,length(number)-2);
cards;
1234567890
123456
987654321
8888888
999999999
4242424
;
run;
ex3:
data
have;
input
char $char20.;
cards
;
1234567890
123456
987654321
8888888
999999999
4242424
run
;
data
want;
set
have;
length
char_new $
5
;
char_new=left(reverse(char));
char_new=reverse(char_new);
run
;
proc
print
data
=want;
run
;
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment