Functions and CALL Routines

# CALL RANCAU Routine

Returns a random variate from a Cauchy distribution.
 Category: Random Number

## Syntax

 CALL RANCAU(seed,x);

### Arguments

seed

is the seed value. A new value for seed is returned each time CALL RANCAU is executed.

 Range: seed < 231 - 1 Note: If seed 0, the time of day is used to initialize the seed stream. See: Seed Values and Comparison of Seed Values in Random-Number Functions and CALL Routines for more information about seed values
x

is a numeric SAS variable. A new value for the random variate x is returned each time CALL RANCAU is executed.

The CALL RANCAU routine updates seed and returns a variate x that is generated from a Cauchy distribution that has a location parameter of 0 and scale parameter of 1.

By adjusting the seeds, you can force streams of variates to agree or disagree for some or all of the observations in the same, or in subsequent, DATA steps.

An acceptance-rejection procedure applied to RANUNI uniform variates is used. If u and v are independent uniform (-1/2, 1/2) variables and u2+v2 1/4, then u/v is a Cauchy variate.

For a discussion and example of an effective use of the random number CALL routines, see Starting, Stopping, and Restarting a Stream.

The CALL RANCAU routine gives greater control of the seed and random number streams than does the RANCAU function.

```options nodate pageno=1 linesize=80 pagesize=60;

data case;
retain Seed_1 Seed_2 Seed_3 45;
do i=1 to 10;
call rancau(Seed_1,X1);
call rancau(Seed_2,X2);
X3=rancau(Seed_3);
if i=5 then
do;
Seed_2=18;
Seed_3=18;
end;
output;
end;
run;

proc print;
id i;
var Seed_1-Seed_3 X1-X3;
run;```

This example uses the CALL RANCAU routine:

```options pageno=1 ls=80 ps=64 nodate;

data u1(keep=x);
seed = 104;
do i = 1 to 5;
call rancau(seed, X);
output;
end;
call symputx('seed', seed);
run;

data u2(keep=x);
seed = &seed;
do i = 1 to 5;
call rancau(seed, X);
output;
end;
run;

data all;
set u1 u2;
z = rancau(104);
run;

proc print label;
label x = 'Separate Streams' z = 'Single Stream';
run;```

```                                 The SAS System                                1

Separate      Single
Obs     Streams      Stream

1     -0.6780     -0.6780
2      0.1712      0.1712
3      1.1372      1.1372
4      0.1478      0.1478
5     16.6536     16.6536
6      0.0747      0.0747
7     -0.5872     -0.5872
8      1.4713      1.4713
9      0.1792      0.1792
10     -0.0473     -0.0473
```

 Functions:

 Previous Page | Next Page | Top of Page