楼主: webgu
32002 74

[学习分享] SAS专版精要贴索引目录--JUN 07, 2013更新...   [推广有奖]

41
迅哥儿2012 在职认证  发表于 2013-4-15 23:28:33
辛苦了!
waiting

42
hlyz2008 发表于 2013-4-15 23:29:24
很不错的帖子,顶你!!!

43
webgu 发表于 2013-4-16 08:58:52
新增 playmore 宏系列。
SAS资源
1. SAS 微信:StatsThinking
2. SAS QQ群:348941365

44
402play 发表于 2013-4-16 14:49:04
options

    mprintsymbolgen mlogic

      ;

%macro ransample_data(dsin,dsout,Replacement,SampleSize);

%if %upcase("&Replacement")="YES"  %then%do;

%*creating random sample with replacement;

   data &dsout(drop=i);

    do i=1to &SampleSize;

        PickIt=ceil(ranuni(123)*TotObs);

        ObsPicked=PickIt;

        set &dsin point=PickIt   nobs=TotObs;

        output;

      end;

      stop;

run;

%end;

%else  %if %upcase("&Replacement")="NO"  %then%do;

%* create random sample without replace;

  data &dsout(drop=SampleSize ObsLeft);

         SampleSize=&SampleSize;

         ObsLeft=TotObs;

         do while(SampleSize>0and ObsLeft>0) ;

           PickIt+1;

         if ranuni(123)<SampleSize/ObsLeft then

           do;

                ObsPicked=PickIt;

                set &dsin point=PickIt nobs=TotObs;

                output;

                SampleSize=SampleSize-1;

               end;

              ObsLeft=ObsLeft-1;

            end;

     stop;

run;

%end;

%else  %putERROR:Replacement shout be  yes or no ;

%mendransample_data;

   



   

%ransample_data(sashelp.class, class_data_rep,yes,10);

%ransample_data(sashelp.class, class_data_norep,no,10);

  %ransample_data(sashelp.class, class_data_norep,whatever,10);

45
美髯客 发表于 2013-4-17 09:27:40
千求百寻中,找到了支持!

46
美髯客 发表于 2013-4-17 09:28:16
千求百寻中,找到了支持!

47
yeting2000 在职认证  发表于 2013-4-17 09:42:54
看看

48
sl050326 发表于 2013-4-17 10:19:59

thanks! good job!

49
pxxs23 在职认证  学生认证  发表于 2013-4-17 19:43:15
有待学习

50
知识2012 发表于 2013-4-18 16:57:40
支持,辛苦了,谢谢。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 06:15