The dataset can use the Truncated String Comparison Operators (such as
<=:) for truncated string comparisons. However, you find that the Colon operator is not available in PROC SQL.
In Proc SQL, you can use the Truncated String Operators such as EQT, GTT, LTT, GET, LET and NET.
The truncated string comparison operator is used to compare two strings. The difference between PROC SQL and conventional comparison operators is that it trims the longer string to the same length as the shorter string before executing the comparison.
Both operands remain unchanged when the truncation is performed internally. The following table lists the truncated comparison operators:
|EQT||equal to truncated strings||where Name eqt ‘Aust’;|
|GTT||greater than truncated strings||where Name gtt ‘Bah’;|
|LTT||less than truncated strings||where Name ltt ‘An’;|
|GET||greater than or equal to truncated strings||where Country get ‘United A’;|
|LET||less than or equal to truncated strings||where Lastname let ‘Smith’;|
|NET||not equal to truncated strings||where Style net ‘TWO’;|
The following example returns a list of Countries that have
'CO' at the beginning of their names:
proc sql; Title "List of countries beginning with the characters'CO'"; select Name from sashelp.demographics where Name eqt 'CO'; quit;
The following example returns a list of countries that have
'U' to ‘
Z‘ at the beginning of their names:
proc sql; Title 'List of countries beginning with the letter 'U' and later'; select Name from sashelp.demographics where Name get 'U'; quit;
So, this was our side on Truncated String Comparison Operators In Proc SQL. We hope that you must have found it helpful.
Moreover, suggest suggestions in the comment section below if you have other suggestions. We will take those lists in our further blog post.
Thanks for reading!
Do you have any tips to add? Let us know in the comments.