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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 847 views
  • 1 like
  • 2 in conversation