LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 17 Jun 2002 15:54:36 -0400
Reply-To:     Steve Bloom <steve@WHITEHURST-ASSOCIATES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Steve Bloom <steve@WHITEHURST-ASSOCIATES.COM>
Subject:      Re: simplifying a macro
Comments: To: Frank Schiffel <SchifF@DHSS.STATE.MO.US>
In-Reply-To:  <>
Content-Type: text/plain; charset="us-ascii"

One approach is to create a temporary file and then us %include;

data _null_; set input_data; file ''; put "%let hosp ='" var1 +(-1) "';"; put "%let select1 =" var2 +(-1) ";"; put '%discharg;'; run;

%include '';

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Frank Schiffel Sent: Monday, June 17, 2002 3:08 PM To: SAS-L@LISTSERV.UGA.EDU Subject: simplifying a macro

I've written:

%macro discharg;

data it; set i; if hidihosp = &hosp. then output; run;

proc surveyselect data=it n=&select1. method=srs out=file1; run;

proc append base=final data=file1 force; run;

%mend discharg;

%LET hosp ='260107'; %LET select1=48; %discharg;

%LET hosp ='260131'; %LET select1=15; %discharg;

%LET hosp ='260037'; %LET select1=35; %discharg;

which works.

the question is, can I input some sort of file for the hosp and select1 information instead of hardcoding it into the macro. i.e. can the line

%LET hosp ='260037'; %LET select1=35; %discharg;

instead of being repeated for a number of hospitals, be changed to

%LET hosp ='var1'; %LET select1=var2; %discharg;

where there is a data set with

var1 var2 260107 48 260131 15


so that somebody else can change that dataset which is input into the macro?

Back to: Top of message | Previous page | Main SAS-L page