06-07-2013 04:41 PM
The colon is a modifier on the comparison operator, not on the value.
if category eq: "in" then ...
If you are using WHERE instead of IF then you could use LIKE operator:
where category like 'in%' ;
06-07-2013 05:01 PM
i was confused because we use colon operator beisde variable name to pick the variable names starting with the specified
if we have variables var1 to var50
we can just write for example( keep =var
how is this:
if category eq: "in" then ... different from the above????
06-07-2013 07:10 PM
Take a look at this: 24851 - Using a Colon Modifier to Select Observations with Values Beginning with a Specific Characte... or from the doc (SAS(R) 9.3 Language Reference: Concepts, Second Edition) "You can add a colon ( modifier to any of the operators to compare only a specified prefix of a character string."
Or, you can write a program to prove to yourself how the different syntax elements would work.
input string $;
test1 = 'n';
test2 = 'n';
test3 = 'n';
if string =: 'in' then test1 = 'y';
if string = 'in' then test2 = 'y';
if string = 'in:' then test3 = 'y';
proc print data=colon_mod;