```Date: Mon, 29 Mar 1999 10:51:41 -0600 Reply-To: "Kevin F. Spratt" Sender: "SAS(r) Discussion" From: "Kevin F. Spratt" Subject: Re: Solution times of problem across SAS versions and platforms Comments: cc: "edstat-l@jse.stat.ncsu.edu" , "Simon, Steve, PhD" Content-Type: text/plain; charset="us-ascii" The probability of having 4 pairs of numbers in an 8 digit serial number on a dollar bill was presented on the edstat list. The solution below was presented. I don't wish to discuss the technique, but rather noted that the time to complete this task was listed (as summarized below) as 40.18.92. For what it's worth, times to complete under two versions of SAS (6.12 and 7.0) operating under different operating systems are provided below: >Thr probability having 4 different pairs in 8 digits is, >PROB=0.00529200 > >654 data t1(keep=x); >655 cnt=0; total=100000000; >656 do i = 1 to 99999999; >657 x=put(i,z8.); >658 if length(compress(x,'0')) in (6,8) then do; >659 if length(compress(x,'1')) in (6,8) then do; >660 if length(compress(x,'2')) in (6,8) then do; >661 if length(compress(x,'3')) in (6,8) then do; >662 if length(compress(x,'4')) in (6,8) then do; >663 if length(compress(x,'5')) in (6,8) then do; >664 if length(compress(x,'6')) in (6,8) then do; >665 if length(compress(x,'7')) in (6,8) then do; >666 if length(compress(x,'8')) in (6,8) then do; >667 if length(compress(x,'9')) in (6,8) then do; >668 cnt+1; >669 output; >670 *put cnt=; >671 *if cnt >= 20 then stop; >672 end; >673 end; >674 end; >675 end; >676 end; >677 end; >678 end; >679 end; >680 end; >681 end; >682 end; >683 prob =cnt/total; put prob= 10.8; >684 run; > >PROB=0.00529200 >NOTE: The data set WORK.T1 has 529200 observations and 1 variables. >NOTE: DATA statement used: > real time 40:18.92 > cpu time 34:55.27 OS Chip Clock Speed RAM SAS Time ------------------ ----------- ------------ --- ---- -------- OS/2 with fixpak 8 Pentium II 400 Mhz 384 6.12 11:44:27 OS/2 with fixpak 8 Pentium II 400 Mhz 384 7.00 7:55:85 Windows NT Pentium III 500 Mhz 384 6.12 x:xx:xx Windows NT Pentium III 500 Mhz 384 7.00 6:08:54 x currently unavailable ___________________________________________________________ Kevin F. Spratt, Ph.D. Iowa Testing Programs & Spine Diagnostic & Treatment Center & Iowa Spine Research Center 224-D Lindquist Center University of Iowa Iowa City, Iowa 52242 (319) 335-5572 (voice) (319) 335-6399 (fax) Kevin-Spratt@Uiowa.edu (e-mail) ```

Back to: Top of message | Previous page | Main SAS-L page