Hello! My data set has an ID number (character variable) and I want to filter some of observations.
The criteria is if the 3rd and the 4th digits are "RE", then delete.
For example, if the ID is ABRE5550, this observation should be deleted.
What code do I need to use?
Thanks.
if substr(id, 3, 2) = "RE" then delete;
3 is starting position and 2 is length and you need quotes around the value
if substr(id, 3, 4) = RE then delete;Is it correct?
if substr(id, 3, 2) = "RE" then delete;
3 is starting position and 2 is length and you need quotes around the value
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.