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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 768 views
  • 1 like
  • 2 in conversation