Hi experts,
Here I want to extract S ,E ,y letters contains team
for example output
South Africa
Egland
Albany
data dsn;
input team $ 20.;
datalines;
India
India
Australia
South Africa
England
Albany
;
run;
data want;
set dsn;
where team like 'S%' and 'E%' or '_y';
run;
What is wrong with the code you show? Please explain.
I didn't get required output
Required output
South Africa
England
Albany
Please think about this for a minute.
Can a team's name be like 'S%' and also be like 'E%'?
Yes or no? If no, then what is the proper logic, in words, to get the desired result?
Its works
data want;
set dsn;
where team like 'S%' or team like 'E%' or team like '%y%';
proc print noobs;
run;
proc sql;
select team from dsn
where team like 'S%' or team like 'E%' or team like '%y%';
run;
Change your code to this and it'll do the trick for you. Remember, you must fully specify both the variable (team) and the wildcard expression for each value.
data want;
set dsn;
where team like 'S%' or team like 'E%' or team like '%y';
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.