各位高手,小心砖头。
(不小心上传了两个同样的图片,不知道怎么删掉了)
- *** total number of applicants;
- %let total=500;
- data _null_;
- length sunshines happy2013 urspecial message cong $50 already $200;
- *** Defines the Window;
- window brick_throwing color=red rows=30 columns=80
- #5 @18 '******************************************' color=yellow
- #7 @18 ' SASors on Pinggu.org, Happy New Year! ' color=yellow
- #9 @18 '******************************************' color=yellow
- # 14 @10 'Prize Type: ' attr=underline color=yellow
- +10 'Winner: ' attr=underline color=yellow
- # 15 @12 'Sun Shines ' color=yellow
- +10 Sunshines color=yellow protect=yes
- # 16 @12 'Happy 2013 ' color=yellow
- +10 Happy2013 color=yellow protect=yes
- # 17 @12 'U R Special ' color=yellow
- +10 URSpecial color=yellow protect=yes
- # 20 @30 cong color=yellow protect=yes
- # 22 @18 message color=cyan protect=Yes;
- message="Please press ENTER to start.";
- *** Display the window and ask the user to press ENTER;
- display brick_throwing blank;
- link pause ;
- *** Sun shines prize;
- do i=1 to 20 ;
- call missing(already);
- call missing(sunshines);
- *** Get 10 different obs numbers and concatenate them;
- number=0;
- do until (number=10);
- tmp=ceil(ranuni(0)*&total);
- if not indexw(already,cats(tmp)) then do;
- number+1;
- already=catx(" ",already,tmp);
- sunshines=catx(" ",sunshines,tmp);
- end;
- end;
- *** Display the process of drawing "Sun shines prize";
- display brick_throwing noinput;
- link pause ;
- end;
- *** Happy 2013;
- do i=1 to 20 ;
- *** put "Sun shines" winners to the "Black list";
- already=sunshines;
- call missing(happy2013);
- *** Get 5 different obs numbers;
- number=0;
- do until (number=5);
- tmp=ceil(ranuni(0)*&total);
- if not indexw(already,cats(tmp)) then do;
- number+1;
- already=catx(" ",already,tmp);
- happy2013=catx(" ",happy2013,tmp);
- end;
- end;
- *** display the process for "happy 2013";
- display brick_throwing noinput;
- link pause ;
- end;
- *** U R Special;
- do i=1 to 20 ;
- *** make winners invalid for new prize;
- already=catx(" ",sunshines,happy2013);
- do until (flag=0);
- tmp=ceil(ranuni(0)*&total);
- flag=indexw(already,cats(tmp));
- end;
- urspecial =cats(tmp);
- *** Display the process of the last prize;
- display brick_throwing noinput;
- link pause ;
- end ;
- *** wait for 1 second and congratulate the winners;
- do i=1 to 10; link pause; end;
- cong="Congratulations!!!";
- *** press ENTER to close;
- message="Please press Enter to close the window.";
- display brick_throwing blank;
- stop;
- *** Useful for the "rolling" effect;
- pause:
- now=time() ;
- do while((now+0.1)>time()) ;
- end ;
- run;