SAS Component Language Dictionary |
Category: | Control Flow |
Comparisons: | SAS statement with limitations in SCL |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
RETURN<(value)>; |
is a value to be returned by the current method. Value can be an SCL variable, a numeric or character constant, or an expression (except for an array). Use value only for RETURN statements that end METHOD and ENTRY statements.
Details |
When RETURN stops executing statements in the current section of an SCL program, control passes to the next section in the program execution cycle.
The RETURN statement for an ENTRY or METHOD statement block can return value if the ENTRY or METHOD statement contains RETURN=data type. The returned value from the RETURN statement has no effect if the statement does not immediately return the program control back to the calling program.
For details about the RETURN statement in the Base SAS language, see SAS Language Reference: Dictionary.
Example |
Define a method for LIB.CAT.MYCLASS.CLASS that compares two lists, L1 and L2. Return 1 if the strings are identical and 0 if the strings are not identical.
useclass lib.cat.myclass.class; compare: method l1 l2:list return=num; dcl num len1 len2 i; len1=listlen(l1); len2=listlen(l2); if (len1 ^= len2) then return 0; do i=1 to len1; dcl char(1) type; type=itemtype(l1,i); if (type ^= itemtype(l2,i)) then return 0; select type; when ('0') do; if (getitemo(l1,i) ^= getitemo(l2,i)) then return 0; end; when ('N') do; if (getitemn(l1,i) ^= getitemn(l2,i)) then return 0; end; when ('L') do; if (getiteml(l1,i) ^= getiteml(l2,i)) then return 0; end; when ('C') do; if (getitemc(l1,i) ^= getitemc(l2,i)) then return 0; end; otherwise return 0; end; end; return(1); endmethod; enduseclass;
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.