Example 9.8 Generating Random Numbers within a Range of Values
Goal
Generate a specific number of random numbers within a range of values.
Example Features
Featured Step | DATA step |
Featured Step Options and Statements | CATS, CEIL, CHAR, FLOOR, RANUNI, and SUBSTR functions |
Resulting Data Set
Output 9.8 GEN_IDS Data SetGEN_IDS Obs id 1 TY773 2 DX963 3 CE942 4 ED565 5 QL714 6 MF854 7 SA711 8 PX734 9 PL994 10 AD925 11 KA798 12 VK794 13 YD539 14 CI706 15 KI724 16 XZ719 17 NM940 18 HC724 19 UY685 20 YA649 21 PX665 22 YI986 23 ZZ725 24 KL981 25 CJ543 |
Example Overview
This example shows how to use the RANUNI random number function to generate random numbers within a range of values. The RANUNI function generates a rational number noninclusively between ...
Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.