BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mmea
Quartz | Level 8

Hi 

I have a big dataset with a column that have different string in the same row seperated with a comma e.g.:

Column

test xx (0+ år),test xx 2-12 ,xx xx (0+ )

I need a code that can say if the Column contains "test xx (0+ år)," then call it "good" 

 

So in this case the result willl be:

 

column

Good

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

See if you can use this as a template

 

data have;
input x $50.;
datalines;
test xx (0+ år),test xx 2-12 ,xx xx (0+ )
test xx (2+ år),test xx 2-12 ,xx xx (0+ )
test xx 2-12,test xx (0+ år) ,xx xx (0+ )
;

data want;
   set have;
   if find(x, "test xx (0+ år)") then y = "Good";
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

See if you can use this as a template

 

data have;
input x $50.;
datalines;
test xx (0+ år),test xx 2-12 ,xx xx (0+ )
test xx (2+ år),test xx 2-12 ,xx xx (0+ )
test xx 2-12,test xx (0+ år) ,xx xx (0+ )
;

data want;
   set have;
   if find(x, "test xx (0+ år)") then y = "Good";
run;
mmea
Quartz | Level 8

Thank you. It worked. have a good day

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 3 replies
  • 1003 views
  • 1 like
  • 2 in conversation