人大经济论坛下载系统

Excel SPSS Eviews StataSAS S-Plus&R Matlab Lisrel&AMOS Gauss 其他
返回首页
当前位置: 主页 > 经济类软件及教程 > SAS >

SAS Macro Language (Stanford University 的sas 宏的课件)+ SAS宏语言基础 中文版

文件格式:其他 可复制性:可复制 TAG标签: sas 点击次数: 更新时间:2010-03-13 13:43
介绍

MACRO SHOW2(field);
   CALL VNAME(&FIELD,NAME);
   put @1 "  *" @4 NAME @13 " = " &FIELD.  +B1";"; *******; %mend show2;

%MACRO SHOW3(field);
   CALL VNAME(&FIELD,NAME);
   put @1 "   " @4 NAME @13 " = . "  +B1";";       *******; %mend show3;

/*..... End Macro Code ..............................................*/

%*PROC SORT DATA = LIBRARY.SAMPLES;
PROC SORT DATA = &InLibref..&InData.
          OUT  = SAMPLES;
          BY     DONOR;

PROC GLM DATA     = SAMPLES NOPRINT;
        *CLASS      DONOR;
         BY         DONOR;
         MODEL      &MODVARS. = DONOR;
         OUTPUT
         OUT      = UPP
         RSTUDENT = &GLMVARS.;

PROC SORT DATA = UPP
          OUT  = RANGE;
          BY     MPEPNUM FORMNMBR DONOR;

DATA   _NULL_;
retain B1    -1;  /* Pointer Control */
retain total  0;
retain outl   0;

file &PRNTFILE;

set RANGE end = EndoFile;

LENGTH ID 3;  ID = 0;
LENGTH NAME $8; /* Used in MACRO SHOW */

/*  Array Processing for output variables  */

array OUTLIER{*} 3  &GLMVARS.;

array SCORE{*} 3    &MODVARS.;

DO I = 1 TO DIM(SCORE);
   IF SCORE{i} NE . THEN TOTAL+1;
   end;

DO I = 1 TO DIM(OUTLIER);
   IF (   ABS(OUTLIER{i}) GE 3   ) THEN DO;
      %ID(REVIEW:  OUTLIER)
      %SHOW(OUTLIER{i})
      %SHOW2(SCORE{i})
      %SHOW3(SCORE{i})
      end;**** ABS GE &STATVAL ***********;
   end;*** Array Processing****;

IF ENDOFILE THEN DO;
   PCTOUT = (OUTL/TOTAL);
   FORMAT PCTOUT PERCENT8.2;
   END;

/*  End of Record -- NO EDITS BELOW THIS LINE *************************/

if ID  then put "END; *MPEPNum PROCESSING;";

if EndoF

下载地址
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------