Download presentation
Presentation is loading. Please wait.
Published byFlorence Woods Modified over 9 years ago
1
The ‘SKIP’ Macro Plagiarized from a paper by Paul Grant Private Healthcare Systems, Inc. given at SUGI 23, Nashville, TN, 1998
2
The Problem You want to rerun a SAS program, without running certain sections of code.
3
Two Solutions /*...*/ style comments For some procedures: run cancel;
4
/* 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;
5
/* 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; */ Duh-o! I already have comments.
6
%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; Solution: The SKIP macro
7
%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; SKIP can be repeated
8
Options NOSOURCE If the skipped code is very long, you may want to prevent it from being printed to your SAS log. options nosource; %macro skip; data ages;... run; %mend skip; options source;
9
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.