Learning SAS? Welcome to the exclusive online community for all SAS learners.

[What does the COLON mean] - IF UPCASE(First_NAME)=:'AND' THEN ...

Reply
N/A
Posts: 1

[What does the COLON mean] - IF UPCASE(First_NAME)=:'AND' THEN ...

IF UPCASE(First_NAME)=:'AND' THEN FNAME=First_NAME;

What does the colon before "AND" mean ?

Thanks in advance.

Super User
Super User
Posts: 6,500

Re: [What does the COLON mean] - IF UPCASE(First_NAME)=:'AND' THEN ...

: modifier means to apply the operator to truncated data.  The match is only up to the length of the shorter of the two arguments.

So in this case it means that values of FIRST_NAME that begin with AND will be copied into the FNAME variable.  But since it truncates both arguments it will also match when FIRST_NAME is equal to 'A' or 'AN' .

Frequent Contributor
Posts: 83

Re: [What does the COLON mean] - IF UPCASE(First_NAME)=:'AND' THEN ...

The colon after the equals sign shortens the length of the above compare to 3 characters,  First name begining with 'AND' will match.  In the case above 'A'  or 'AN'  will not match.

Super User
Super User
Posts: 6,500

Re: [What does the COLON mean] - IF UPCASE(First_NAME)=:'AND' THEN ...

As long as the variable FIRST_NAME is defined to be length 3 or more.

Ask a Question
Discussion stats
  • 3 replies
  • 343 views
  • 1 like
  • 3 in conversation