Your SlideShare is downloading. ×
Call Execute For Everyone
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Call Execute For Everyone

989
views

Published on

An example of using SAS CALL EXECUTE for a data manager, a programmer and a statistician.

An example of using SAS CALL EXECUTE for a data manager, a programmer and a statistician.


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
989
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CALL EXECUTE for everyone! Examples for programmer, statistician, and data manager
  • 2. Overview
    • Short introduction CALL EXECUTE
    • Examples:
    • Programmer
    • Statistician
    • Data Manager
  • 3. Remember
    • The DATA step operates as a loop
    • CALL EXECUTE writes the code as the DATA step is processed
    • The generated code can use values from SAS data set variables
    • This code is executed after the DATA step
    • Keep it simple
  • 4. Where do I start?
    • Work Backwards
    • Write the basic statement in open code
    • Pick out the pieces of code to be replaced by data set variables
    • Create a data set containing the values needed for your basic statement
    • Write a DATA step with CALL EXECUTE
  • 5. 1. Programmer
  • 6. The Problem
    • Run all programs in a directory or in many directories.
    • One program with %INCLUDE statements.
    • Misspellings , new programs
  • 7. Work Backwards
    • Basic code:
    • %INCLUDE " Z:XXXprogname.sas " ;
    • Will Translate into:
    • CALL EXECUTE( '%INCLUDE "Z:XXX' ||pgmname|| '";' );
    Data set variable Piece to replace
  • 8. Create the Data set
    • FILENAME file1 PIPE 'dir Z:XXXPrograms' ;
    • DATA sasfiles;
    • LENGTH pgmname $ 200 ;
    • INFILE file1 TRUNCOVER ;
    • INPUT sasfile $ 1 - 200 ;
    • pgmname=SCAN(sasfile,- 1 , ' ' );
    • IF SCAN(sasfile,- 1 , '.' )= 'sas' ;
    • RUN ;
  • 9. Resulting in:
  • 10. Final Code
    • DATA _NULL_ ;
    • SET sasfiles;
    • CALL EXECUTE( '%INCLUDE "Z:XXX' ||pgmname|| '";' );
    • RUN ;
  • 11. What happens??
    • NOTE: CALL EXECUTE generated line.
    • 1 + %INCLUDE Z:XXXProgram1.sas
    • ...
    • NOTE: CALL EXECUTE generated line.
    • 2 + %INCLUDE Z:XXXProgram2.sas
    • ...
    • NOTE: CALL EXECUTE generated line.
    • 3 + %INCLUDE Z:XXXProgram3.sas
    • ...
    • NOTE: CALL EXECUTE generated line.
    • 4 + %INCLUDE Z:XXXProgram4.sas
  • 12. 2. Statisticians
  • 13. The Problem
    • Create consistent symbols for Graphs
    • Lab graphs with subpopulations
  • 14. Simple Graph
  • 15. Simple Graph
  • 16. Subpopulation
  • 17. Solution?
    • Write the SYMBOL statements based on the values of treatment (TPATT)
  • 18. Create macro variables containing SYMBOL definition. Common Prefix Value of Treatment SYMBOL Definition
  • 19. Data Set with Treatments to be Used in Graph
  • 20. Create our a little more complex CALL EXECUTE
    • DATA _NULL_ ;
    • SET _trts;
    • CALL EXECUTE ( 'SYMBOL' ||PUT(_N_, 8. -L)|| ' &trt' ||LEFT(tpatt)|| ';' );
    • RUN ;
    Incremental Number Common Prefix Value of Treatment
  • 21. What happens??
    • NOTE: CALL EXECUTE generated line.
    • 1 + SYMBOL1 I=J V=CIRCLE L=7 C=BLACK;
    • 2 + SYMBOL2 I=J V=STAR L=3 C=BLACK;
    • 3 + SYMBOL3 I=J V=DIAMOND L=5 C=BLACK;
    • 4 + SYMBOL4 I=J V=DOT L=1 C=BLACK;
  • 22. With 3 groups
    • NOTE: CALL EXECUTE generated line.
    • 1 + SYMBOL1 I=J V=CIRCLE L=7 C=BLACK;
    • 2 + SYMBOL2 I=J V=STAR L=3 C=BLACK;
    • 3 + SYMBOL3 I=J V=DOT L=1 C=BLACK;
  • 23. Statisticians are happy now!
  • 24. 3. Data Managers
  • 25. The Problem
    • Search through LIBNAMEs for incorrect data points (Dates, negative values etc.)
    • Time consuming!
  • 26. Basic Code %LET lib=PHARMA; %LET lockdt='23SEP2005'D;
  • 27. Find all date variables in &lib.
  • 28. Multiple Records per LIBDOTMEM
  • 29. Compress Data into One Record per LIBDOTMEM
  • 30. Final Data Set!
  • 31. Easy CALL EXECUTE Statement
  • 32.  
  • 33. Contact info: Daniel Boisvert Genzyme Corporation [email_address] Shafi Chowdhury [email_address] www.shaficonsulatancy.com
  • 34. Questions, comments or complaints?