Anton Amirkhanov
Anton Amirkhanov

Reputation: 21

RETURNS and RETURN statements in METHODS in DS2 used in SAS

Could someone give me a very simple example of a METHOD in SAS DS2 where both RETURNS and RETURN words (statements) are used and it is clear what those words RETURNS and RETURN actually mean.

Upvotes: 0

Views: 201

Answers (1)

Richard
Richard

Reputation: 27508

  • returns is a DS2 method statement definition specifier indicating what kind of value the method returns.
  • return is a DS2 statement that returns a value to the caller

Example

proc ds2;
  data _null_;
    method minus_one(double operand) returns double;
      return operand-1;
    end;
    method run();
      declare double x y;
      x = 1;
      y = minus_one(x);
      put x= y=;
    end;
  enddata;
run;
quit;

The Proc DS2 documentation is a good place to start if you want basic information.

Upvotes: 1

Related Questions