所在位置: 网站运营

如何更好的创建一个SAS宏(英文).pdf 16页

2020-03-07 23:07:24 来源:网站运营 阅读 ()

  Building the Better Macro:k9PGT目录网址

k9PGT目录网址

  Best Practices for the Design ofk9PGT目录网址

k9PGT目录网址

  Reliable, Effective Toolsk9PGT目录网址

k9PGT目录网址

  Frank DiIoriok9PGT目录网址

k9PGT目录网址

  CodeCrafters, Inc.k9PGT目录网址

k9PGT目录网址

  Till June 15 th … Chapel Hill, NCk9PGT目录网址

k9PGT目录网址

  Then … Philadelphia, PAk9PGT目录网址

k9PGT目录网址

  Premise and Scopek9PGT目录网址

k9PGT目录网址

  ? Macro language is a powerful adjunct to the SASk9PGT目录网址

k9PGT目录网址

  Systemk9PGT目录网址

k9PGT目录网址

  ? Its flexibility is an assetk9PGT目录网址

k9PGT目录网址

  ? Its flexibility is a liabilityk9PGT目录网址

k9PGT目录网址

  ? Some self-imposed structure is neededk9PGT目录网址

k9PGT目录网址

  ? To do the "right thing"k9PGT目录网址

k9PGT目录网址

  ? To simplify coding and debuggingk9PGT目录网址

k9PGT目录网址

  This paper presents a collection of design guidelines.k9PGT目录网址

k9PGT目录网址

  They [1] are not exhaustive [2] are "arguable" (e.g.,k9PGT目录网址

k9PGT目录网址

  "What?! No mention of function-style macros!!"k9PGT目录网址

k9PGT目录网址

  Well … no)k9PGT目录网址

k9PGT目录网址

  1k9PGT目录网址

k9PGT目录网址

  Reasons to Care (1 of 2)k9PGT目录网址

k9PGT目录网址

  Your macro:k9PGT目录网址

k9PGT目录网址

  %do i=1 %to &nDatasets.;k9PGT目录网址

k9PGT目录网址

  %let dset=%scan(&dsList., &i.);k9PGT目录网址

k9PGT目录网址

  %dsetN(data=&dset., count=nobs)k9PGT目录网址

k9PGT目录网址

  %if &nobs. > 0 %then %do;k9PGT目录网址

k9PGT目录网址

  … ODS, PROC REPORT statements …k9PGT目录网址

k9PGT目录网址

  %end;k9PGT目录网址

k9PGT目录网址

  %end;k9PGT目录网址

k9PGT目录网址

  Seems harmless, but it loops, always displaying thek9PGT目录网址

k9PGT目录网址

  first dataset in the list.k9PGT目录网址

k9PGT目录网址

  We trace the problem to %dsetN, which set &I=1k9PGT目录网址

k9PGT目录网址

  Easily fixed (make scope of I in dsetN=local), butk9PGT目录网址

k9PGT目录网址

  irritating that we have to fix itk9PGT目录网址

k9PGT目录网址

  Reasons to Care (2 of 2)k9PGT目录网址

k9PGT目录网址

  Your macro:k9PGT目录网址

k9PGT目录网址

  %missVars(data=clin.ae, out=ae_miss,k9PGT目录网址

k9PGT目录网址

  keep=usubjid)k9PGT目录网址

k9PGT目录网址

  proc print data=ae_miss;k9PGT目录网址

k9PGT目录网址

  id usubjid;k9PGT目录网址

k9PGT目录网址

  title "Variables in CLIN.AE thatk9PGT目录网址

k9PGT目录网址

  had all missing values";k9PGT目录网址

k9PGT目录网址

  run;k9PGT目录网址

k9PGT目录网址

  The macro ran correctly, but left temporary datasetsk9PGT目录网址

k9PGT目录网址

  and macro variables in the SAS session.k9PGT目录网址

k9PGT目录网址

  It isn't the end of the world, but it is sloppy coding.k9PGT目录网址

k9PGT目录网址

  2k9PGT目录网址

k9PGT目录网址

  1. Know When a Macro Is and Is Not Necessaryk9PGT目录网址

k9PGT目录网址

  Macros are helpful and often essential.k9PGT目录网址

k9PGT目录网址

  Even well-designed and well-dock9PGT目录网址

k9PGT目录网址

点击收藏小提示:按键盘CTRL+D也能收藏哦!
Copyright © 2015-2017 GT目录网址  晋icp备14006692号-1