O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 StepDATA step
Featured Step Options and StatementsCATS, CEIL, CHAR, FLOOR, RANUNI, and SUBSTR functions

Resulting Data Set

Output 9.8 GEN_IDS Data Set

  GEN_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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required