## Exponential Distribution mean too high

Occasional Contributor
Posts: 5

# Exponential Distribution mean too high

When it comes to Simulation using the ranexp function, what would I do if the exponential distribution is greater than 1? For example when I use the following code the output produced is a blank table:

data list1;

do i=1 to 50;

between=.4*ranexp(1.2);

serve=.4*ranexp(1.2);

output list1;

end;

proc print data=list1;

run;

How would I get this to work and have an output produced? Any help would be much appreaciated.

Thanks.

Occasional Contributor
Posts: 5

## SAS Simulation

When it comes to Simulation using the ranexp function, what would I do if the exponential distribution is greater than 1? For example an exponential distribution of 1.2 doesn't produce an Output because 1.2 > 1.
Super User
Posts: 23,343

## Re: Exponential Distribution mean too high

The RANEXP() function is deprecated. And the parameter for the function is the SEED, which controls the random number stream not the function. Make sure to read the latest version of the docs.

This function is deprecated. The function is suitable for small samples and for applications that do not require a sophisticated random-number generator. It is not suitable for parallel and distributed processing. For more demanding applications, use the STREAMINIT subroutine and the RAND('Exponential') function.

The RAND() function however, does support the Exponential distribution with a scale parameter.

http://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p0fpeei0opypg8n1b06qe4r040lv.htm&...

x=RAND('EXPONENTIAL', <σ>)

Super User
Posts: 23,343

## Re: Exponential Distribution mean too high

Oh, and just to close the loop the RANEXP() function takes integer parameters which is why 1.2 doesn't work. Try 2, 3 or 12.

Occasional Contributor
Posts: 5

## Re: Exponential Distribution mean too high

Thanks for this.

I just tried this out and can see that all integers seem to work. However, I'm still struggling to know what function to use to be able to generate results with a 1.2 exponential distribution mean. I've seen the docs you've recommended but I'm struggling to make sense of them.

Super User
Posts: 23,343

## Re: Exponential Distribution mean too high

The function is exactly as I posted above, what part of that are you having difficulty with?

Post your new code if you're having issues and explain what new issues you now have.

Occasional Contributor
Posts: 5

## Re: Exponential Distribution mean too high

This is the new code I tried to use to generate my results, but the between and serve columns still produce blank results.

data list1;
do i=1 to 20;
between=.4*Rand(1.2);
serve=.4*Rand(1.2);
output queue1;
end;
proc print data=list1;
run;

I know it's probably a mistake I've made on my behalf but I can't seem to see where I've gone wrong. Once again thanks for your help.

Super User
Posts: 23,343

## Re: Exponential Distribution mean too high

x=RAND('EXPONENTIAL', <σ>)

You forgot the exponential part...in the formula.

Remember to check the documentation, and that each documentation has an example of how the function is used.

``````data list1;
do i=1 to 20;
between = 0.4 * Rand('exponential', 1.2);
serve = 0.4*Rand('exponential', 1.2);

output queue1; <- this is wrong and changed from your previous code. It needs to match what's on the data line;
end;

RUN; <- You're missing this, technically not needed, but what I'd consider good practice, especially as you learn;

proc print data=list1; <-You (tried to) output your results to Queu1, not list1?;
run;``````

Occasional Contributor
Posts: 5