I have a data.
ID number
1 10022
2 12332
3 12334
4 13452
5 13454
I want to delete the ID which has "number" with last digit which has "4"
I want,
1 10022
2 12332
3 13452
thank you
@Smitha9 wrote:
It is a character, the "number" if its ends with "4" I want to delete the whole row. thanks
if char(number,length(number))='4' then delete;
@Smitha9 wrote:
It is a character, the "number" if its ends with "4" I want to delete the whole row. thanks
if char(number,length(number))='4' then delete;
data want;
set have;
if substr(put(number,z5.),5,1) = '4' then delete;
run;
Hi @Smitha9
Here is another approach using pearl regular expressions:
data want;
set have;
if prxmatch('/4\s*$/',number) then delete;
run;
The PRXMATCH() function looks for the pattern 4 followed by 0, 1 or more blanks (\s*) at the end of the string ($) in the variable 'number'.
Best,
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.