As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Difference between revisions of "Tips:Generating random number seed from the system clock"

From sasCommunity
Jump to: navigation, search
(Fixed WikiReadMore link to only be the article name)
Line 10: Line 10:
  
 
<noinclude>
 
<noinclude>
[[Category:Tip to be Reviewed]]
+
[[Category:Tip Ready]]
 
</noinclude>
 
</noinclude>

Revision as of 07:19, 12 March 2009

When generating random numbers, it is usually recommended that one save the initial SEED used, in case results need to be replicated. This is not easy when using the system clock to generate the SEED. However, one can create a SEED from the system clock using the same algorithm SAS uses.

SEED = 1e3 * mod(round(1e3 * datetime()), 1e6) + 1;

This SEED can then be saved prior to using it.

Submitted by Daniel Nordlund. Contact me at my Discussion Page.

....read more