the ‘skip’ macro plagiarized from a paper by paul grant private healthcare systems, inc. given...
TRANSCRIPT
![Page 1: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/1.jpg)
The ‘SKIP’ MacroThe ‘SKIP’ Macro
Plagiarized from a paper byPlagiarized from a paper by
Paul Grant Paul GrantPrivate Healthcare Systems, Inc.Private Healthcare Systems, Inc.
given at SUGI 23, Nashville, TN, 1998given at SUGI 23, Nashville, TN, 1998
![Page 2: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/2.jpg)
The ProblemThe Problem
You want to rerun a SAS program, without running certain sections of code.
![Page 3: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/3.jpg)
Two SolutionsTwo Solutions
/*...*/ style comments
For some procedures:
run cancel;
![Page 4: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/4.jpg)
<more SAS code to execute>
/*
data ages;
set demog;
agenow = (today()-dob)/365.25;
studyage = (studystrt-dob)/365.25;
run;
*/
proc print data=ages;
var patientid agenow studyage;
run cancel;
data ages;
set ages;
studytime = studystop - studystart;
run;
<more SAS code to execute>
![Page 5: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/5.jpg)
<more SAS code to execute>
/*
data ages;
set demog;
/* Calculate the patient’s current age. */
agenow = (today()-dob)/365.25;
/* Calculate the patient’s age at study start. */
studyage = (studystart-dob)/365.25;
run;
*/
<more SAS code to execute>
Duh-o! I already have comments.Duh-o! I already have comments.
![Page 6: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/6.jpg)
<more SAS code to execute>
%macro skip;data ages; set demog; /* Calculate the patient’s current age. */ agenow = (today()-dob)/365.25; /* Calculate the patient’s age at study start. */ studyage = (studystart-dob)/365.25;run;%mend skip;
<more SAS code to execute>
Solution: The SKIP macroSolution: The SKIP macro
![Page 7: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/7.jpg)
<more SAS code to execute>
%macro skip;data ages; set demog; agenow = (today()-dob)/365.25; studyage = (studystrt-dob)/365.25;run;%mend skip;
proc print data=ages; var patientid agenow studyage;run;
%macro skip;data ages; set ages; studytime = studystop - studystart;run;%mend skip;
<more SAS code to execute>
SKIP can be repeatedSKIP can be repeated
![Page 8: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/8.jpg)
Options NOSOURCEOptions NOSOURCE
If the skipped code is very long, you may want to prevent it from being printed to your SAS log.
<more SAS code to execute>
options nosource;
%macro skip;
data ages;
. . .
run;
%mend skip;
options source;
<more SAS code to execute>
![Page 9: The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998](https://reader036.vdocuments.us/reader036/viewer/2022082713/5697bfb51a28abf838c9d6ee/html5/thumbnails/9.jpg)
The EndThe End