Hello,
I'm comparing two let variables that have multiple strings in each and I want to be able to tell if a string has been added to the second let variable. For an example if I have the following:
%let all_codes_jan = a, b, c, d, e, f;
%let all_codes_march = a, b, c, d, e, f, g;
I want to find that the code g was added and is a value in the second let variable that is not included in the first let variable. I have used in and not in before in proc sql but I dont know how to do this when there are many codes in each variable, and they are not columns in a table.
Thanks in advance for any help you can offer!
What does the result of your comparison actually look like? An assigned value to a macro variable, if so what does it look like? A value in a data set? A message written to the log or results window?
And is this "added" an "added at the end" (as your example implies) or "some value inserted into a random location"?
Or what if the order of values changes? is "a,b,c" the same as "b,c,a"? If not, what is the result?
Is there any particular reasons you are placing commas in the values? If you want to do this with macro coding then the presence of the commas will likely make the code much more complicated because the comma is the delimiter in functions.
For your example (one-character strings), the verify macro would be useful.
See here https://www.lexjansen.com/phuse/2010/po/PO05.pdf
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.