I have a data set that has a variable, "Group". Some cases have the value "Urban-Rural Residence". Some other cases have a value that is almost the same, but for some reason not exactly the same, although I don't see how. Excel thinks the other value is exactly the same.
I doubt it would be worth it to post or send a data set, because I'm not sure if any data set i post or send would actually have the difference in values.
Instead, I would like have code that says the following, and my question is how to do it.
If the value includes the string "Urban" then Group = "Urban-Rural Residence";
Thus, i would find some part of the value that hopefully is identical in all versions of the value, and just manually make them all have the same value.
There seem to be a bunch of sas functions that might do this, but I don't quite get the difference in them all, even though I've searched a bit and read a bunch of stuff. What's the difference between contain, find, findw, index? Or would I use some other function?
Thanks
Gene
Try:
group = compress(group,,'kA');
or
if index(group,'Urban') then group = "Urban-Rural Residence";
Try:
group = compress(group,,'kA');
or
if index(group,'Urban') then group = "Urban-Rural Residence";
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!
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.