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 (August 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Aug 2000 16:55:08 -0400
Reply-To:     "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:      Re: SAS macro for
Comments: To: Lee Medoff <lmedoff@VANTAGETRAVEL.COM>
Content-Type: text/plain; charset="iso-8859-1"

> From: Lee Medoff [mailto:lmedoff@VANTAGETRAVEL.COM] > I'm wondering if anyone knows how to handle the following situation: > I need to create a macro which introduces the values of a > previously created > data set to an ensuing data step. I want it to look > something like this: > DATA LIBNAME.<VALUE PASSED FROM MACRO>; > SET .... > IF JOB = 'VALUE PASSED FROM MACRO'; > RUN; > > This needs to be an iterative (Do-if) loop that should pass a > value for every value of the original data set.

if I understand you correctly you want to generate the four lines of code above for every row in some control data set?

flesh this idea out, will you?

do you want to create a number of subsets of our control data set? and have the name of the data set equal to the value of a variable?

DATA CONTROL; infile cards; input @1 Name $char1.;cards; A B C ;

/*expected statements: data LIBRARY.A LIBRARY.B LIBRARY.C ;set CONTROL; if Job = 'A' then output A; if Job = 'B' then output B; if Job = 'C' then output C; /*************************/ data _NULL_; call execute('data '); do until(EndoFile); set CONTROL end = EndoFile; call execute('LIBRARY.' !! Name); end;

call execute(';set CONTROL;); EndoFile = 0;%*reset;

do until(EndoFile); set CONTROL end = EndoFile; %expected statement: if Job = 'A' then output A; call execute("if Job = '" %*sQuote open; !! trim(Name) !! "' then output " %*sQuote close; !! Name !! ';'); end; stop; run;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov ---> cheerful provider of UNTESTED SAS code!*! <--- archives: http://www.listserv.uga.edu/archives/sas-l.html


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