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:-)
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.