/* seedemo3.sas */ /* */ /* shows difference between random functions and call function */ /* as well as how seed works */ /* modified from SAS documentation */ options ls=80 ; data a ; * retain seed1 seed2 seed3 45 ; * initialize all three to 45 ; seed1 = 45 ; seed2 = 45 ; seed3 = 45 ; input case $ ; do i = 1 to 6 ; * loop ; call ranuni(seed1,x1) ; * unif(0,1) using CALL ; call ranuni(seed2,x2) ; * another ; x3 = ranuni(seed3) ; * unif(0,1) using function ; if( i eq 3 ) then do ; * change things ; seed2 = 18 ; seed3 = 18 ; end ; * of do block ; output ; end ; * of loop ; cards ; first second run ; proc print data=a ; var case seed1-seed3 x1-x3 ; title 'seeds and difference between CALL and functions' ; run ;