Dear All,
I have below dataset where few records in TERM column have more than 1 word. I need to identify such records and flag them
ID TERM
101 VOMITING
101 HEADACHE and NAUSEA
102 FATIGUE
102 PYREXIA/COLD
My output should be as below:
ID TERM FLAG
101 VOMITING
101 HEADACHE and NAUSEA Y
102 FATIGUE
102 PYREXIA/COLD Y
Please help.
Try this
data have;
input ID TERM $ 5 - 25;
datalines;
101 VOMITING
101 HEADACHE and NAUSEA
102 FATIGUE
102 PYREXIA/COLD
;
data want;
set have;
flag = ifc(countw(term, ' /') > 1, 'Y', '');
run;
Try this
data have;
input ID TERM $ 5 - 25;
datalines;
101 VOMITING
101 HEADACHE and NAUSEA
102 FATIGUE
102 PYREXIA/COLD
;
data want;
set have;
flag = ifc(countw(term, ' /') > 1, 'Y', '');
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.