turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Exponential Distribution mean too high

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-10-2017 01:46 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASUSER97

12-10-2017 12:27 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASUSER97

12-10-2017 01:53 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASUSER97

12-10-2017 01:56 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-10-2017 02:13 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASUSER97

12-10-2017 02:15 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-10-2017 02:25 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASUSER97

12-10-2017 11:15 PM

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;
```

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SASUSER97

12-11-2017 02:13 AM

Thanks for all the help, it was extremely useful. I managed to figure out where I went wrong in the end and I've got it done now