Hello everyone,
I just found in the documentation how the operator "=:" works. (much like the "like"-operator). I find this this veryy useful. I thereafter guessed that there might also exist a "in:" operator, which I found there indeed do exist. This allows users to search for the starting letters in several strings at same time. However, I can not find the description of the operator in the documentation - can anyone send a link, or is it only for experimental use?
Here an example:
data exclusion;
format dx $8.;
input dx $;
if dx in: ('3912', '429');
cards;
3912
3913
391218
x4290
429
42901
;
run;
gives this dataset:
3912
391218
429
42901
Operator is the same as =: but with OR between each item.
X =: 'val1' or X =: 'val2'
Also, not just IN, you can add it to >, <, etc, in fact:
You can add a colon ( : ) modifier to any of the operators to compare only a specified prefix of a character string. See Character Comparisons for details.
Operator is the same as =: but with OR between each item.
X =: 'val1' or X =: 'val2'
Also, not just IN, you can add it to >, <, etc, in fact:
You can add a colon ( : ) modifier to any of the operators to compare only a specified prefix of a character string. See Character Comparisons for details.
Go to this link
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm
Search for "Character Comparisons" on the web page. You would find documentation on =: operator
Yes, that right. It says ":" can be added any modifyer to compare only the prefix.
I would wish I had knew that earlier, which would have made life much easier:-)
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.