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 (May 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 12 May 2008 07:06:01 -0700
Reply-To:   Ali G <Alistair.Gordon@NEWTYNE.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ali G <Alistair.Gordon@NEWTYNE.COM>
Organization:   http://groups.google.com
Subject:   Include code based on data set variable
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

Is it possible to dynamically include some code into a datatep based on a dataset variable?

Using 9.1.3 on Sun Solaris

Something like this.

filename c1 '/path/code1.sas'; filename c2 '/path/code2.sas'; filename c3 '/path/code3.sas';

data codes; code='c1'; output; code='c2'; output; code='c3'; output; run;

data process; set codes; /* So here CODE resolves to be c1, c2 etc and this in turn points to code1.sas etc */ %include code; run;

I have been challenged to make a program more efficient and at the moment it contains a step that currently resembles this:

data process; set codes; if code='c1' then %include c1; else if code='c2' then etc...; . . else if code='C107' then etc;

But there are hundreds of unique code values and the codes dataset contains tens of millions of rows...

Any ideas?

Many thanks.


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