Dynamic Macro Invocation Utility Paul D Sherman, San Jose, CA
|
|
- Stephen Carson
- 5 years ago
- Views:
Transcription
1 Paper Dynamic Macro Invocation Utility Paul D Sherman, San Jose, CA ABSTRACT Often times it is necessary to repeatedly call a macro with only minor differences in its argument list. Most common is the application of producing multiple graphs panelized into an aggregate. The following simple macro %invoke() builds an argument list with a collection of index number suffixed positional parameters and calls a desired macro with a subset of these parameters as needed until all parameters have been accomodated. Resulting is a set of output having identical structure with customized content, all for the price of a single macro call. Skill Level: Intermediate to Advanced, familiarity with SAS/MACRO, SAS/GRAPH and Base/SAS. INTRODUCTION The SAS macro language is a powerful, important facility for coding in object-oriented style. Common code can be separated from a main application and encapsulated forming lots of little stand-alone subroutines. Macros can be nested, one may invoke another which invokes another, and so on. Good coding style dictates that no routine, method or function body should be longer than one typed page in length. The use of SAS macros help achieve this goal such as exemplified below %macro main; %bloknote(start, main); %init; %dothis; %macro init;... %dealwith(1.9); %macro dothis;... %dealwith(3.2); %macro dealwith(args); %dealwith(7.4); %bloknote(open, dealwith(&args.)); %cleanup; %put handling &args.; %bloknote(end); %bloknote(close); However, there is no easy way to repeatedly invoke the same object macro with differing argument values. One may copy/paste macro invocations and hard-wire argument values into each call, but this solution is static to run-time and not easily adaptable or maintainable. Non-identical macro re-invocation is often used when one desires to perform the same operations on varying content - such as creating a collection of similar looking web pages. HOW IT WORKS The heart of %invoke() is a double nested loop, the outer most iterating target macro calls while the inner most spins through each call's parameter list. Supposing i is the outer loop index while j is the inner loop index, at any time the target parameter is simply i+j do i=0; this many macro calls... do j=0;... with this many parms/call process (i+j)th parameter here... end; end; It is the user's responsibility to make sure their target macro handles the appropriate quantities of positional parameters. Because many SAS procedures expect and produce the first of a series of output content un-suffixed, without any numeric index, %invoke() handles this special occurance by skipping the argument index concatenation during the very first loop iteration. It is also critically important to make sure there are no spaces between base name and index suffix. Thus, we must trim and take only the non-trivial substring. Further, in order to preserve the constant length object name we must shorten the base name string by as many characters as are the length of the index number. In other words, index numbers zero through nine remove only the last base name character, while index numbers 10 through 99 remove the last two base name characters, and so on. This default SAS naming convention follows from the legacy eight character maximum dataset name length. For all but the last argument in each invocation we must also append the argument delimeter, being a single comma. The last step of each iteration is the macro call itself. A single de-reference of both base name and assembled argument list is prepended with a percent symbol, telling SAS that it is to be interpreted as a macro name. Once again, there will be serious errors (i.e., macro un-resolution) if the user's target macro does not handle the same quantity of arguments which % invoke() builds.
2 EXAMPLE: MULTI-GRAPH PANEL Assume one has a library macro which takes six parameters and produces a 3x2 graphics catalog layout. %macro plot3x2(one, two, three, four, five, six); %bloknote(open, plot3x2(&one.,&two.,&three.,&four.,&five.,&six.)); proc greplay igout=sugi29.graphs gout=sugi29.slides tc=sugi29.templt template=day3by2 nofs ; template day3by2; %* see appendix for coords *; treplay 1:&one. 2:&two. 3:&three. 4:&four. 5:&five. 6:&six. ; run; quit; %bloknote(close); Further suppose there are routinely seven sets of individual pictures created, one set per day, which are to be presented weekly as a single page. Arranging each picture to have successive numbers, the weekly task of producing panelized plots is easy %invoke(plot3x2, pix, 7, 6); SAS will execute automatically the following seven calls to %plot3x2() %plot3x2(pix, pi1, pi2, pi3, pi4, pi5); %plot3x2(pi6, pi7, pi8, pi9, p10, p11);... %plot3x2(p36, p37, p38, p39, p40, p41); One then finds seven entries in the graphics catalog, each of which look something like greplay grepla pi6 pi7 pi grepla pi9 p36 p37 p p39 p40 p EXAMPLE: WEB PAGE BUILDER It is nice to have up-to-date web content, and for the content to look and feel as similar as possible from one day to the next. One therefore has a library macro which takes three parameters and creates an html file precisely placing these three items on the web page. Furthermore, it is desired for example that the first item be shown as a thumbnail, the second only as a link (since its highly detailed) and the last as full size in the web page body. %macro makepage(thumb, link, body); %bloknote(open, makepage(&thumb., &link., &body.)); filename foo ""; data _null_; file foo; output <html>; output <body>; output <p><a href="&thumb..html">; output <img src="&thumb..gif">; output </a></p>; output <p><a href="&link..html">the link</a></p>; output <p><img src="&body..gif"></p>; output </body>; output </html>; run; filename foo clear; %bloknote(close); Using the %invoke() utility the summary pages are easily created %invoke(makepage, pix, 7, 3);
3 SAS executes these seven calls to %makepage() %makepage(pix, pi1, pi2); %makepage(pi3, pi4, pi5);... %makepage(p18, p19, p20); The summary pages are then always available and automatically customized and annotated specifically for each group of picture content. An example of the last page is shown below / \ p18.gif \ / the link p20.gif ADVANCED OPTIONS SHOWZERO= { true false } When one's target macro expects the first argument index to be explicitly numbered, the default SAS behavior can be overridden via keyword variable SHOWZERO=true. Although some SAS procedures leave off the 'zero' when creating and naming a series of objects, a very common macro programming paradigm is the &&var&i style of dynamically creating names. Clearly, all values of index variable i are treated equally; it is rare to see code such as %do i=0; %to 15; %if i eq 0 %then; %do; &var %else; %do; &&var&i The SHOWZERO= parameter value is not case sensitive, but must be only either true or false. Any other value is ignored, reverting to the default (i.e. false) parameter numbering scheme. SHOWZERO=false SHOWZERO=true aname aname0 aname1 aname1 aname2 aname2 SAMESIZE= { true false } Some SAS procedures such as those which create graphics catalog objects preserve the length of their constituent object names while creating and consecutively numbering them. Depending upon how many digits are in the index number, that many characters are taken away from the base name, going from right to left. A series of plots may have been named and labeled this way, for which we must accomodate when %invoke() looks for its parameter argument values. As above, the value is not case sensitive, but must be only either true or false. Any other value is ignored, reverting to the default (i.e. true) parameter name length preservation scheme. SAMESIZE=false SAMESIZE=true aname aname aname1 anam1 aname2 anam aname56 ana aname243 an243 PASSTHRU= There may be desired a common argument delivered identically to each target macro call. One therefore supplies keyword variable PASSTHRU= which by default is undefined. When supplied, it's value is the first positional parameter to each target macro invocation. With minor changes to %invoke()'s code, however, one may place this optional pass-through value at the end of the dynamically numbered arguments. OUTNAME= Sometimes there is need to uniquely and explicitly name the iterated output content. Such is not necessary in the case of the graphics catalog - items are given system generated names. When creating files, for example html (text) files, one might not want to over-write existing files or control explicitly a file naming scheme. Using the optional OUTNAME= keyword parameter, each invocation of the target macro receives this value, suffixed with incrementing index corresponding to each iteration. As described above, the default SAS behavior of invisible zero follows here, and can be overridden by using the SHOWZERO= option as well. We assume input parameters and output names follow the same numbering scheme; if this is not the case (rare), minor easy code revisions to %invoke() can be made.
4 COMPLETE EXAMPLE: ALL OPTIONS Using all available options to %invoke(), the following statement %invoke(amacro, thing, 5, 3, SHOWZERO=true, SAMESIZE=false, PASSTHRU=foo, OUTNAME=page ); will produce these SAS macro invocations %amacro(foo, page0, thing0, thing1, thing2); %amacro(foo, page1, thing3, thing4, thing5);... %amacro(foo, page4, thing12, thing13, thing14); where one might use the first two (required) positional parameters of %mymacro() as follows %macro amacro(uservars, outname, one, two, three); %bloknote(open, amacro(&uservars.,&outname.,&one.,&two.,&three.)); filename foo "&outname..html"; data _null_; file foo; output <html>; output <body>; output <h1>the &uservars. Page</h1>; output <p>args</p>; output <dl> output <dt>one</dt><dd>&one.</dd>; output <dt>two</dt><dd>&two.</dd>; output <dt>three</dt><dd>&three.</dd>; output </dl> output </body>; output </html>; run; filename foo clear; %bloknote(close); creating automatically these five web pages page0.html page1.html T page2.html T page3.html A T page4.html * A T * * A The foo Page * * * A +-- * * * Args +-- * * * one = thi * * two = thi * three = thi CONCLUSION We have shown two very common examples of repeatedly and dynamically streaming incrementally indexed parameter lists. With its available options the functionality of %invoke() is bound to be very widely used from handling graphics catalog content to creating files, sending or performing further and higher levels of content summarization. Although some assumptions have been made, we believe these are minor and easily customized in the utility's code. Together with the Log Manager, a SAS programmer will find their application code error-free and, if trouble should arise, easily debugged. REFERENCES Carpenter, Arthur L., Carpenter's Complete Guide to the SAS Macro Language, Cary, NC: SAS Institute, Inc., pp. Carpenter, Arthur L. and Shipp, Charles E., Quick Results with SAS/GRAPH Software, Cary, NC: SAS Institute, Inc., pp. Sherman, Paul, Intelligent SAS Log Manager, in Proceedings of the Twenty-Sixth Annual SAS User Group International Conference. Cary, NC: SAS Institute, Inc., p ACKNOWLEDGEMENTS With humble pleasure I thank Art Carpenter for giving me the insight and knowledge from which my understanding of the SAS Macro Language is derived. Mike Metts deserves significant credit for his brilliant and artistic style of presenting complex information in simple and intuitive ways - I would not have known the full range of possibilities of the graphics catalog without him. Lastly, I am grateful to IBM Corporation and Hitachi Global Storage Technology for providing the tools and opportunity which made this work possible.
5 TRADEMARK CITATION SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute, Inc. in the USA and other countries. indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Paul D Sherman 310 Elan Village Lane, Apt. 117 San Jose CA Phone: sherman@idiom.com SOURCE CODE options nosource; /* ========================================= */ /* INVOKE - Dynamic Macro Invocation Utility */ /* Repeatedly calls a desired macro using an */ /* equal size subset of number appended base */ /* name positional parameter arguments. */ /* Example: */ /* %invoke(foo, item, 12, 3); */ /* will produce */ /* %foo(item, ite1, ite2); */ /* %foo(ite3, ite4, ite5); */ /* %foo(ite6, ite7, ite8); */ /* Options: */ /* SHOWZERO= whether to show index number 0 */ /* SAMESIZE= keep each parm name same length*/ /* PASSTHRU= literal positional parm */ /* OUTNAME= number suffixed positional parm */ /* /19/2003 pds -Initial cut */ /* ========================================= */ %macro invoke(mname, base, num, step=4, SHOWZERO=false, SAMESIZE=true, PASSTHRU=., OUTNAME=.); %local args name i j n; %do i=0 %to %eval(&num. - 1) %by %step.; %let args = %str(); %do j=0; %to %eval(%step. - 1); %* append the item number... *; %let n = %eval(&i. + &j.); %if %lower(&showzero.) eq true %then %do; %if %lower(&samesize.) eq true %then %do; %let name = %trim(%qsubstr(&base., 1, %length(&base.) - %length(&n.))); %let name = &name.%left(%trim(&n.)); %else %if &n. eq 0 %then %do; %* default SAS doesnt suffix first item with numeric zero *; %let name = &base.; %else %do; %if %lower(&samesize.) eq true %then %do; %let name = %trim(%qsubstr(&base., 1, %length(&base.) - %length(&n.))); %let name = &name.%left(%trim(&n.)); %*... accumulate the arg list... *; %let args = &args.&name.;
6 %*... provide the parm delimeter... *; %if &j. lt %eval(&step. - 1) %then %do; %let args = &args.,; %*... prepend index numbered outname first if present... *; %if &OUTNAME. ne. %then %do; %if %lower(&showzero.) eq true %then; %do; %let args = &OUTNAME.%left(%trim(&i.)),&args.; %else %if &i. eq 0 %then %do; %let args = &OUTNAME.,&args.; %else %do; %let args = &OUTNAME.%left(%trim(&i.)),&args.; %*... then the literal pass through stuff *; %if &PASSTHRU. ne. %then %do; %let args = &PASSTHRU.,&args.; %&mname.(&args.); /* =============================== */ /* amacro - typical macro template */ /* =============================== */ %macro amacro(uvar, oname, one, two, three); %put amacro is processing &one., &two. and &three. for SUGI-&uvar. and creating &oname..htm; /* ================================== */ /* main - typical program entry point */ /* ================================== */ %macro main(args); %local basename nsugi nparms nstats; %* show Contrib, Invited and SAS papers for each SUGI section *; %let basename = Sugi ; %let nstats = 3; %put.; %put Long Beach, CA; %let nsugi = 26; %let nparms = 6; %invoke(amacro, &basename.&nsugi., &nparms., &nstats., OUTNAME=sugi, PASSTHRU=&nSugi.); %put.; %put Orlando, FL; %let nsugi = 27; %let nparms = 9; %invoke(amacro, &basename.&nsugi., &nparms., &nstats., OUTNAME=sugi, PASSTHRU=&nSugi.); %put.; %put Seattle, WA; %let nsugi = 28; %let nparms = 8; %invoke(amacro, &basename.&nsugi., &nparms., &nstats., OUTNAME=sugi, PASSTHRU=&nSugi.); %put.; %put Montreal, ON; %let nsugi = 29; %let nparms = 10; %invoke(amacro, &basename.&nsugi., &nparms., &nstats., OUTNAME=sugi, PASSTHRU=&nSugi.);
7 /* program execution starts here */ options nonotes noovp nomerror nomprint nomlogic nosymbolgen errors=max msymtab=max mvarsize=max mautosource mrecall sasautos=(sasautos) linesize=256 pagesize=1000 nocenter nodate yearcutoff=1920 cleanup serror nostimer dsnferr ; main(); EXAMPLE LOG. Long Beach, CA amacro is processing Sugi, Sugi 1 and Sugi 2 for SUGI-26 and creating sugi26.htm amacro is processing Sugi 3, Sugi 4 and Sugi 5 for SUGI-26 and creating sugi26.htm amacro is processing... amacro is processing Sugi_15, Sugi_16 and Sugi_17 for SUGI-26 and creating sugi26.htm. Orlando, FL amacro is processing Sugi, Sugi 1 and Sugi 2 for SUGI-27 and creating sugi27.htm amacro is processing Sugi 3, Sugi 4 and Sugi 5 for SUGI-27 and creating sugi27.htm amacro is processing... amacro is processing Sugi_24, Sugi_25 and Sugi_26 for SUGI-27 and creating sugi27.htm. Seattle, WA amacro is processing Sugi, Sugi 1 and Sugi 2 for SUGI-28 and creating sugi28.htm amacro is processing Sugi 3, Sugi 4 and Sugi 5 for SUGI-28 and creating sugi28.htm amacro is processing... amacro is processing Sugi_21, Sugi_22 and Sugi_23 for SUGI-28 and creating sugi28.htm. Montreal, ON amacro is processing Sugi, Sugi 1 and Sugi 2 for SUGI-29 and creating sugi29.htm amacro is processing Sugi 3, Sugi 4 and Sugi 5 for SUGI-29 and creating sugi29.htm amacro is processing... amacro is processing Sugi_27, Sugi_28 and Sugi_29 for SUGI-29 and creating sugi29.htm
8 EXAMPLE TEMPLATE day3by2 /* ====================================== */ /* DAY3BY2 - Weekly 3 across, 2 down */ /* Creates template DAY3BY2 in the */ /* TEMPLT catalog of library SUGI29 */ /* Layout: */ /* */ /* */ /* one two three */ /* */ /* */ /* four five six */ /* */ /* */ /* Coordinates: */ /* Panel L-left U-left U-right L-right */ /* 1 x: */ /* y: */ /* 2 x: */ /* y: */ /* 3 x: */ /* y: */ /* 4 x: */ /* y: */ /* 5 x: */ /* y: */ /* 6 x: */ /* y: */ /* ====================================== */ proc greplay nofs tc=sugi29.templt; tdef day3x2 des='weekly 3 across, 2 down' 1 / llx=0.0 ulx=0.0 urx=33.0 lrx=33.0 lly=50.0 uly=100.0 ury=100.0 lry= / llx=33.0 ulx=33.0 urx=66.0 lrx=66.0 lly=50.0 uly=100.0 ury=100.0 lry= / llx=66.0 ulx=66.0 urx=99.0 lrx=99.0 lly=50.0 uly=100.0 ury=100.0 lry= / llx=0.0 ulx=0.0 urx=33.0 lrx=33.0 lly=0.0 uly=50.0 ury=50.0 lry=0.0 5 / llx=33.0 ulx=33.0 urx=66.0 lrx=66.0 lly=0.0 uly=50.0 ury=50.0 lry=0.0 6 / llx=66.0 ulx=66.0 urx=99.0 lrx=99.0 lly=0.0 uly=50.0 ury=50.0 lry=0.0 ; run; quit;
Hypothesis Testing: An SQL Analogy
Hypothesis Testing: An SQL Analogy Leroy Bracken, Boulder Creek, CA Paul D Sherman, San Jose, CA ABSTRACT This paper is all about missing data. Do you ever know something about someone but don't know who
More informationMANAGING SAS/GRAPH DISPLAYS WITH THE GREPLAY PROCEDURE. Perry Watts IMS Health
MANAGING SAS/GRAPH DISPLAYS WITH THE PROCEDURE Perry Watts IMS Health Abstract PROC is used for redisplaying graphs that have been stored in temporary or permanent catalogs. This tutorial will show how
More informationDeveloping a Dashboard to Aid in Effective Project Management
Developing a Dashboard to Aid in Effective Project Management M. Paige Borden, University of Central Florida, Orlando, FL Maureen Murray, University of Central Florida, Orlando, FL Ali Yorkos, University
More informationA Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures
A Juxtaposition of Tables and Graphs Using SAS /GRAPH Procedures Suhas R. Sanjee, MaxisIT Inc., Edison, NJ Sheng Zhang, Merck and Co., Upper Gwynedd, PA ABSTRACT Graphs provide high-impact visuals that
More informationODS LAYOUT is Like an Onion
Paper DP03_05 ODS LAYOUT is Like an Onion Rich Mays, University of Rochester Medical Center, Rochester, NY Abstract ODS LAYOUT is like an onion. They both make you cry? No! They both have layers! In version
More informationFoundations and Fundamentals. SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc.
SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc., Cary, NC ABSTRACT It is not uncommon for the first draft of any macro application to contain errors.
More informationPROC CATALOG, the Wish Book SAS Procedure Louise Hadden, Abt Associates Inc., Cambridge, MA
ABSTRACT Paper CC58 PROC CATALOG, the Wish Book SAS Procedure Louise Hadden, Abt Associates Inc., Cambridge, MA SAS data sets have PROC DATASETS, and SAS catalogs have PROC CATALOG. Find out what the little
More informationArthur L. Carpenter California Occidental Consultants, Oceanside, California
Paper 028-30 Storing and Using a List of Values in a Macro Variable Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT When using the macro language it is not at all
More informationInnovative Graph for Comparing Central Tendencies and Spread at a Glance
Paper 140-28 Innovative Graph for Comparing Central Tendencies and Spread at a Glance Varsha C. Shah, CSCC, Dept. of Biostatistics, UNC-CH, Chapel Hill, NC Ravi M. Mathew, CSCC,Dept. of Biostatistics,
More informationPharmaSUG 2015 Paper PO03
PharmaSUG 2015 Paper P03 A Visual Reflection on SAS/GRAPH History: Plot, Gplot, Greplay, and Sgrender Haibin Shu, AccuClin Global Services LLC, Wayne, PA John He, AccuClin Global Services LLC, Wayne, PA
More informationMacro Quoting: Which Function Should We Use? Pengfei Guo, MSD R&D (China) Co., Ltd., Shanghai, China
PharmaSUG China 2016 - Paper 81 Macro Quoting: Which Function Should We Use? Pengfei Guo, MSD R&D (China) Co., Ltd., Shanghai, China ABSTRACT There are several macro quoting functions in SAS and even some
More informationSAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD
Paper BB-7 SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD ABSTRACT The SAS Macro Facility offers a mechanism for expanding and customizing
More informationStoring and Reusing Macros
101 CHAPTER 9 Storing and Reusing Macros Introduction 101 Saving Macros in an Autocall Library 102 Using Directories as Autocall Libraries 102 Using SAS Catalogs as Autocall Libraries 103 Calling an Autocall
More informationGenerating Participant Specific Figures Using SAS Graphic Procedures Carry Croghan and Marsha Morgan, EPA, Research Triangle Park, NC
DP05 Generating Participant Specific Figures Using SAS Graphic Procedures Carry Croghan and Marsha Morgan, EPA, Research Triangle Park, NC ABSTRACT An important part of our research at the US Environmental
More informationGetting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA
SESUG 2012 Paper HW-01 Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA ABSTRACT Learning the basics of PROC REPORT can help the new SAS user avoid hours of headaches.
More informationSUGI 29 Posters. Paper A Group Scatter Plot with Clustering Xiaoli Hu, Wyeth Consumer Healthcare., Madison, NJ
Paper 146-29 A Group Scatter Plot with Clustering Xiaoli Hu, Wyeth Consumer Healthcare., Madison, NJ ABSTRACT In pharmacokinetic studies, abnormally high values of maximum plasma concentration Cmax of
More informationPosters. Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA. Paper
Paper 223-25 Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA ABSTRACT As part of its effort to insure that SAS Software is useful to its users, SAS Institute
More informationA Plot & a Table per Page Times Hundreds in a Single PDF file
A Plot & a Table per Page Times Hundreds in a Single PDF file Daniel Leprince DIEM Computing Services, Inc. Elizabeth Li DIEM Computing Services, Inc. SAS is a registered trademark or trademark of SAS
More informationUsing a Control Dataset to Manage Production Compiled Macro Library Curtis E. Reid, Bureau of Labor Statistics, Washington, DC
AP06 Using a Control Dataset to Manage Production Compiled Macro Library Curtis E. Reid, Bureau of Labor Statistics, Washington, DC ABSTRACT By default, SAS compiles and stores all macros into the WORK
More informationWHAT ARE SASHELP VIEWS?
Paper PN13 There and Back Again: Navigating between a SASHELP View and the Real World Anita Rocha, Center for Studies in Demography and Ecology University of Washington, Seattle, WA ABSTRACT A real strength
More informationPowerful SAS R Techniques from the Windows API Samuel T. Croker
ABSTRACT Paper SD01 Powerful SAS R Techniques from the Windows API Samuel T. Croker Ever wonder how well that old laptop battery is performing? Is it possible to do online tests of a laptop battery to
More informationCreate Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel
Create Flowcharts Using Annotate Facility Priya Saradha & Gurubaran Veeravel Abstract With mounting significance to the graphical presentation of data in different forms in the pharmaceutical industry,
More informationCustomized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA
ABSTRACT Customized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA Data visualization is becoming a trend in all sectors where critical business decisions or assessments
More informationChanging Titles on Graphs With Minimal Processing
Changing Titles on Graphs With Minimal Processing Deb Cassidy, Computer Horizons Corporation, Indianapolis, IN Have you ever created numerous graphs only to have someone make a "minor" change in the title
More informationcapabilities and their overheads are therefore different.
Applications Development 3 Access DB2 Tables Using Keylist Extraction Berwick Chan, Kaiser Permanente, Oakland, Calif Raymond Wan, Raymond Wan Associate Inc., Oakland, Calif Introduction The performance
More informationKEYWORDS Metadata, macro language, CALL EXECUTE, %NRSTR, %TSLIT
MWSUG 2017 - Paper BB15 Building Intelligent Macros: Driving a Variable Parameter System with Metadata Arthur L. Carpenter, California Occidental Consultants, Anchorage, Alaska ABSTRACT When faced with
More informationUSING SAS PROC GREPLAY WITH ANNOTATE DATA SETS FOR EFFECTIVE MULTI-PANEL GRAPHICS Walter T. Morgan, R. J. Reynolds Tobacco Company ABSTRACT
USING SAS PROC GREPLAY WITH ANNOTATE DATA SETS FOR EFFECTIVE MULTI-PANEL GRAPHICS Walter T. Morgan, R. J. Reynolds Tobacco Company ABSTRACT This presentation introduces SAS users to PROC GREPLAY and the
More informationUTILIZING SAS TO CREATE A PATIENT'S LIVER ENZYME PROFILE. Erik S. Larsen, Price Waterhouse LLP
UTILIZING SAS TO CREATE A PATIENT'S LIVER ENZYME PROFILE Erik S. Larsen, Price Waterhouse LLP In pharmaceutical research and drug development, it is usually necessary to assess the safety of the experimental
More informationUsing PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA
Using PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA ABSTRACT This paper describes for an intermediate SAS user the use of PROC REPORT to create
More informationUsing GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China
PharmaSUG China 2015 - Paper PO71 Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China One of the reasons that SAS is widely used as the
More informationBase and Advance SAS
Base and Advance SAS BASE SAS INTRODUCTION An Overview of the SAS System SAS Tasks Output produced by the SAS System SAS Tools (SAS Program - Data step and Proc step) A sample SAS program Exploring SAS
More informationIntroduction. Getting Started with the Macro Facility CHAPTER 1
1 CHAPTER 1 Introduction Getting Started with the Macro Facility 1 Replacing Text Strings Using Macro Variables 2 Generating SAS Code Using Macros 3 Inserting Comments in Macros 4 Macro Definition Containing
More informationtitle1 "Visits at &string1"; proc print data=hospitalvisits; where sitecode="&string1";
PharmaSUG 2012 Paper TF01 Macro Quoting to the Rescue: Passing Special Characters Mary F. O. Rosenbloom, Edwards Lifesciences LLC, Irvine, CA Art Carpenter, California Occidental Consultants, Anchorage,
More informationCHAPTER 7 Using Other SAS Software Products
77 CHAPTER 7 Using Other SAS Software Products Introduction 77 Using SAS DATA Step Features in SCL 78 Statements 78 Functions 79 Variables 79 Numeric Variables 79 Character Variables 79 Expressions 80
More informationJob Security: Using the SAS Macro Language to Full Advantage
Job Security: Using the SAS Macro Language to Full Advantage Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT As has been discussed in other papers on the topic of
More informationDisplaying Multiple Graphs to Quickly Assess Patient Data Trends
Paper AD11 Displaying Multiple Graphs to Quickly Assess Patient Data Trends Hui Ping Chen and Eugene Johnson, Eli Lilly and Company, Indianapolis, IN ABSTRACT Populating multiple graphs, up to 15, on a
More informationSAS Programming Conventions Lois Levin, Independent Consultant
SAS Programming Conventions Lois Levin, Independent Consultant INTRODUCTION This paper presents a set of programming conventions and guidelines that can be considered in developing code to ensure that
More informationChapter 7 File Access. Chapter Table of Contents
Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108
More informationThis Too Shall Pass: Passing Simple and Complex Parameters In and Out of Macros
ABSTRACT Paper 078-2018 This Too Shall Pass: Passing Simple and Complex Parameters In and Out of Macros Ted D. Williams, PharmD, BCPS, Magellan Method Even a rudimentary knowledge of SAS macros will highlight
More informationMacro Architecture in Pictures Mark Tabladillo PhD, marktab Consulting, Atlanta, GA Associate Faculty, University of Phoenix
Paper PS16_05 Macro Architecture in Pictures Mark Tabladillo PhD, marktab Consulting, Atlanta, GA Associate Faculty, University of Phoenix ABSTRACT The qualities which SAS macros share with object-oriented
More informationAlias Macros, a Flexible Versioning System for Standard SAS Macros
Paper CS06 Alias Macros, a Flexible Versioning System for Standard SAS Macros Jean-Michel Bodart, UCB Pharma, Braine-l'Alleud, Belgium Guido Wendland, UCB Pharma, Monheim, Germany ABSTRACT The Alias Macros
More informationPaper SAS Programming Conventions Lois Levin, Independent Consultant, Bethesda, Maryland
Paper 241-28 SAS Programming Conventions Lois Levin, Independent Consultant, Bethesda, Maryland ABSTRACT This paper presents a set of programming conventions and guidelines that can be considered in developing
More informationMy Reporting Requires a Full Staff Help!
ABSTRACT Paper GH-03 My Reporting Requires a Full Staff Help! Erin Lynch, Daniel O Connor, Himesh Patel, SAS Institute Inc., Cary, NC With cost cutting and reduced staff, everyone is feeling the pressure
More informationHow to Implement the One-Time Methodology Mark Tabladillo, Ph.D., MarkTab Consulting, Atlanta, GA Associate Faculty, University of Phoenix
Paper PO-09 How to Implement the One-Time Methodology Mark Tabladillo, Ph.D., MarkTab Consulting, Atlanta, GA Associate Faculty, University of Phoenix ABSTRACT This paper demonstrates how to implement
More informationPLA YING WITH MACROS: TAKE THE WORK OUT OF LEARNING TO DO MACROS. Arthur L. Carpenter
PLA YING WITH MACROS: TAKE THE WORK OUT OF LEARNING TO DO MACROS Arthur L. Carpenter ABSTRACT The macro language can add an additional level of complexity to programs written in SAS~. Macro statements
More informationThe Basics of PROC FCMP. Dachao Liu Northwestern Universtiy Chicago
The Basics of PROC FCMP Dachao Liu Northwestern Universtiy Chicago ABSTRACT SAS Functions can save SAS users time and effort in programming. Each release of SAS has new functions added. Up to the latest
More informationUsing SAS to Control the Post Processing of Microsoft Documents Nat Wooding, J. Sargeant Reynolds Community College, Richmond, VA
Using SAS to Control the Post Processing of Microsoft Documents Nat Wooding, J. Sargeant Reynolds Community College, Richmond, VA Chen, SUGI 31, showed how to use SAS and VBA to automate the post processing
More informationSimplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA
PharmaSUG 2017 BB07 Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA ABSTRACT One often uses an iterative %DO loop to execute a section of a macro
More informationHow to Create Data-Driven Lists
Paper 9540-2016 How to Create Data-Driven Lists Kate Burnett-Isaacs, Statistics Canada ABSTRACT As SAS programmers we often want our code or program logic to be driven by the data at hand, rather than
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationMultiple Graphical and Tabular Reports on One Page, Multiple Ways to Do It Niraj J Pandya, CT, USA
Paper TT11 Multiple Graphical and Tabular Reports on One Page, Multiple Ways to Do It Niraj J Pandya, CT, USA ABSTRACT Creating different kind of reports for the presentation of same data sounds a normal
More informationCustomizing Your SAS Session
13 CHAPTER 2 Customizing Your SAS Session Introduction 13 Specifying System Options in the SAS Command 14 Configuration Files 15 Creating a User Configuration File 15 Specifying a User Configuration File
More informationA Simple Time Series Macro Scott Hanson, SVP Risk Management, Bank of America, Calabasas, CA
A Simple Time Series Macro Scott Hanson, SVP Risk Management, Bank of America, Calabasas, CA ABSTRACT One desirable aim within the financial industry is to understand customer behavior over time. Despite
More informationEffectively Utilizing Loops and Arrays in the DATA Step
Paper 1618-2014 Effectively Utilizing Loops and Arrays in the DATA Step Arthur Li, City of Hope National Medical Center, Duarte, CA ABSTRACT The implicit loop refers to the DATA step repetitively reading
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationABSTRACT: INTRODUCTION: WEB CRAWLER OVERVIEW: METHOD 1: WEB CRAWLER IN SAS DATA STEP CODE. Paper CC-17
Paper CC-17 Your Friendly Neighborhood Web Crawler: A Guide to Crawling the Web with SAS Jake Bartlett, Alicia Bieringer, and James Cox PhD, SAS Institute Inc., Cary, NC ABSTRACT: The World Wide Web has
More informationOne SAS To Rule Them All
SAS Global Forum 2017 ABSTRACT Paper 1042 One SAS To Rule Them All William Gui Zupko II, Federal Law Enforcement Training Centers In order to display data visually, our audience preferred Excel s compared
More informationSYSTEM 2000 Essentials
7 CHAPTER 2 SYSTEM 2000 Essentials Introduction 7 SYSTEM 2000 Software 8 SYSTEM 2000 Databases 8 Database Name 9 Labeling Data 9 Grouping Data 10 Establishing Relationships between Schema Records 10 Logical
More informationA SAS Macro to Generate Caterpillar Plots. Guochen Song, i3 Statprobe, Cary, NC
PharmaSUG2010 - Paper CC21 A SAS Macro to Generate Caterpillar Plots Guochen Song, i3 Statprobe, Cary, NC ABSTRACT Caterpillar plots are widely used in meta-analysis and it only requires a click in software
More informationSAS Macro Programming for Beginners
ABSTRACT SAS Macro Programming for Beginners Lora D. Delwiche, Winters, CA Susan J. Slaughter, Avocet Solutions, Davis, CA Macro programming is generally considered an advanced topic. But, while macros
More informationA Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN
Paper 045-29 A Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN ABSTRACT: PROC MEANS analyzes datasets according to the variables listed in its Class
More informationSAS Strategy Management 5.2 Batch Maintenance Facility
SAS Strategy Management 5.2 Batch Maintenance Facility User's Guide SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2010. SAS Strategy Management
More informationChoosing the Right Procedure
3 CHAPTER 1 Choosing the Right Procedure Functional Categories of Base SAS Procedures 3 Report Writing 3 Statistics 3 Utilities 4 Report-Writing Procedures 4 Statistical Procedures 5 Efficiency Issues
More informationThe SAS Interface to REXX
95 CHAPTER 9 The SAS Interface to REXX Overview 95 The Subcommand Environment 96 Retrieving and Assigning the Values of REXX Variables in a SAS Program 97 Using the GETEXEC DATA Step Function 97 Using
More informationUNIT-IV: MACRO PROCESSOR
UNIT-IV: MACRO PROCESSOR A Macro represents a commonly used group of statements in the source programming language. A macro instruction (macro) is a notational convenience for the programmer o It allows
More informationA Time Saver for All: A SAS Toolbox Philip Jou, Baylor University, Waco, TX
South Central SAS Users Group 2016 A Time Saver for All: A SAS Toolbox Philip Jou, Baylor University, Waco, TX ABSTRACT SAS Macros are a useful tool to any SAS Programmer. A macro variable can be used
More informationSAS Data Libraries. Definition CHAPTER 26
385 CHAPTER 26 SAS Data Libraries Definition 385 Library Engines 387 Library Names 388 Physical Names and Logical Names (Librefs) 388 Assigning Librefs 388 Associating and Clearing Logical Names (Librefs)
More informationSAS Macro. SAS Training Courses. Amadeus Software Ltd
SAS Macro SAS Training Courses By Amadeus Software Ltd AMADEUS SOFTWARE LIMITED SAS TRAINING Amadeus have been delivering SAS Training since 1989 and our aim is to provide you with best quality SAS training
More informationABSTRACT INTRODUCTION THE ODS TAGSET FACILITY
Graphs in Flash Using the Graph Template Language Himesh Patel, SAS Institute Inc., Cary, NC David Kelley, SAS Institute Inc., Cary, NC Dan Heath, SAS Institute Inc., Cary, NC ABSTRACT The Graph Template
More information(Refer Slide Time: 01:12)
Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #22 PERL Part II We continue with our discussion on the Perl
More informationABSTRACT INTRODUCTION THE GENERAL FORM AND SIMPLE CODE
Paper SA06 Painless Extraction: Options and Macros with PROC PRESENV Keith Fredlund, MS (candidate) Grand Valley State University, Allendale, Michigan; Thinzar Wai, MS (candidate) Grand Valley State University,
More informationUSING DATA TO SET MACRO PARAMETERS
USING DATA TO SET MACRO PARAMETERS UPDATE A PREVIOUS EXAMPLE %macro report(regs=); %let r=1; %let region=%scan(®s,&r); %do %until(®ion eq ); options nodate pageno=1; ods pdf file="®ion..pdf";
More informationHow to Implement the One-Time Methodology Mark Tabladillo, Ph.D., Atlanta, GA
How to Implement the One-Time Methodology Mark Tabladillo, Ph.D., Atlanta, GA ABSTRACT This tutorial will demonstrate how to implement the One-Time Methodology, a way to manage, validate, and process survey
More informationUsing Recursion for More Convenient Macros
Paper BB-04 Using Recursion for More Convenient Macros Nate Derby, Stakana Analytics, Seattle, WA ABSTRACT There are times when a macro needs to alternatively be applied to either one value or a list of
More informationPharmaSUG Paper TT10 Creating a Customized Graph for Adverse Event Incidence and Duration Sanjiv Ramalingam, Octagon Research Solutions Inc.
Abstract PharmaSUG 2011 - Paper TT10 Creating a Customized Graph for Adverse Event Incidence and Duration Sanjiv Ramalingam, Octagon Research Solutions Inc. Adverse event (AE) analysis is a critical part
More informationUsing SAS/OR to Optimize Scheduling and Routing of Service Vehicles
Paper SAS1758-2018 Using SAS/OR to Optimize Scheduling and Routing of Service Vehicles Rob Pratt, SAS Institute Inc. ABSTRACT An oil company has a set of wells and a set of well operators. Each well has
More informationLanguage Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */
Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,
More informationPHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)
PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) A Server-side Scripting Programming Language An Introduction What is PHP? PHP stands for PHP: Hypertext Preprocessor. It is a server-side
More informationAn Introduction to Macros Deb Cassidy
Paper #HW03 An Introduction to Macros Deb Cassidy Abstract A search in the proceedings for SUGI 24-28 for the word "macro" had over 1,000 hits. Why are macros so popular? A quick glance through the papers
More informationValidation Summary using SYSINFO
Validation Summary using SYSINFO Srinivas Vanam Mahipal Vanam Shravani Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents a macro that produces a Validation Summary using SYSINFO
More informationAndrew H. Karp Sierra Information Services, Inc. San Francisco, California USA
Indexing and Compressing SAS Data Sets: How, Why, and Why Not Andrew H. Karp Sierra Information Services, Inc. San Francisco, California USA Many users of SAS System software, especially those working
More informationUSING SAS HASH OBJECTS TO CUT DOWN PROCESSING TIME Girish Narayandas, Optum, Eden Prairie, MN
Paper RF-12-2014 USING SAS HASH OBJECTS TO CUT DOWN PROCESSING TIME Girish Narayandas, Optum, Eden Prairie, MN ABSTRACT Hash tables are in existence since SAS 9 version and are part of data step programming.
More informationThe TRANTAB Procedure
1291 CHAPTER 40 The TRANTAB Procedure Overview 1291 Concepts 1292 Understanding Translation Tables and Character Sets 1292 Storing Translation Tables 1292 Modifying Institute-supplied Translation Tables
More informationUsing MACRO and SAS/GRAPH to Efficiently Assess Distributions. Paul Walker, Capital One
Using MACRO and SAS/GRAPH to Efficiently Assess Distributions Paul Walker, Capital One INTRODUCTION A common task in data analysis is assessing the distribution of variables by means of univariate statistics,
More informationAPPENDIX 2 Customizing SAS/ASSIST Software
241 APPENDIX 2 Customizing SAS/ASSIST Software Introduction 241 Setting User Profile Options 241 Creating an Alternate Menu Bar 243 Introduction This appendix describes how you can customize your SAS/ASSIST
More informationSAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC
PharmaSUG2010 - Paper TT06 SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC ABSTRACT One great leap that beginning and intermediate
More informationDETECTING ANOMALIES IN YOUR DATA USING ROUNDED NUMBERS Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA
DETECTING ANOMALIES IN YOUR DATA USING ROUNDED NUMBERS Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA ABSTRACT Analyzing large amounts of data looking for anomalies can be a disheartening
More informationSquare Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint
PharmaSUG 2018 - Paper DV-01 Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint Jane Eslinger, SAS Institute Inc. ABSTRACT An output table is a square. A slide
More informationAre you Still Afraid of Using Arrays? Let s Explore their Advantages
Paper CT07 Are you Still Afraid of Using Arrays? Let s Explore their Advantages Vladyslav Khudov, Experis Clinical, Kharkiv, Ukraine ABSTRACT At first glance, arrays in SAS seem to be a complicated and
More informationGoing Under the Hood: How Does the Macro Processor Really Work?
Going Under the Hood: How Does the Really Work? ABSTRACT Lisa Lyons, PPD, Inc Hamilton, NJ Did you ever wonder what really goes on behind the scenes of the macro processor, or how it works with other parts
More informationChapter 1 INTRODUCTION. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 INTRODUCTION SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Facilities and features of PL/1. Structure of programs written in PL/1. Data types. Storage classes, control,
More informationGetting it Done with PROC TABULATE
ABSTRACT Getting it Done with PROC TABULATE Michael J. Williams, ICON Clinical Research, San Francisco, CA The task of displaying statistical summaries of different types of variables in a single table
More informationABSTRACT. Paper CC-031
Paper CC-031 Using Functions SYSFUNC and IFC to Conditionally Execute Statements in Open Code Ronald J. Fehd, Centers for Disease Control and Prevention, Atlanta, GA, USA ABSTRACT Audience Keywords Information
More informationDBLOAD Procedure Reference
131 CHAPTER 10 DBLOAD Procedure Reference Introduction 131 Naming Limits in the DBLOAD Procedure 131 Case Sensitivity in the DBLOAD Procedure 132 DBLOAD Procedure 132 133 PROC DBLOAD Statement Options
More informationContents of SAS Programming Techniques
Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal
More informationCoders' Corner. Paper ABSTRACT GLOBAL STATEMENTS INTRODUCTION
Paper 70-26 Data Visualization of Outliers from a Health Research Perspective Using SAS/GRAPH and the Annotate Facility Nadia Redmond Kaiser Permanente Center for Health Research, Portland, Oregon ABSTRACT
More informationUsing SAS Macro to Include Statistics Output in Clinical Trial Summary Table
Using SAS Macro to Include Statistics Output in Clinical Trial Summary Table Amy C. Young, Ischemia Research and Education Foundation, San Francisco, CA Sharon X. Zhou, Ischemia Research and Education
More informationAn Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY
SESUG 2016 Paper BB-170 An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY ABSTRACT A first step in analyzing
More information%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System
%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System Rushi Patel, Creative Information Technology, Inc., Arlington, VA ABSTRACT It is common to find
More informationFly over, drill down, and explore
ABSTRACT Paper 79-2013 Fly over, drill down, and explore Suzanne Brown, HealthInsight New Mexico, Albuquerque, NM Data often have a spatial dimension, whether it is a five-year financial plan and annual
More information