Date: Mon, 4 Sep 2006 21:23:43 -0400
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: making code generic
In-Reply-To: <1157388159.084451.20120@e3g2000cwe.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Argen,
Forget the Antiquated Macro Language and investigate the more modern
SAS Component language. Your task will be trivially easy with SAS
Component Language. If you still have problems after reading the
excellent online docs for SAS Component Language, send me a note
offline, and I will tell you exactly how to do what you want to do and
provide the code you need..
Joe
On 9/4/06, Arjen <a.benedictus@gmail.com> wrote:
> Hello SAS-L,
>
> I have the following code (see below). The format Results converts
> numeric data into character data (see my postings last week). The macro
> variables refer to sas data set variables in Have7 with all different
> names (lab tests, medical examinations). How can I make my code more
> generic? That is, suppose I have data set Have21 with variables
> referred to as &d34 to &d39, then would it be possible that I don't
> have to enter all the numbers again but (for instance) only specify the
> interval?
>
> Specifying the interval _&d7-_&d11 does not work because these macro
> variables refer to real variables that don't contain numeric
> indicators.
>
> data Have7 (drop=i _&d7 _&d8 _&d9 _&d10 _&d11);
> set Have7;
> array nn [1:5] _&d7 _&d8 _&d9 _&d10 _&d11;
> array cc [1:5] $ &d7 &d8 &d9 &d10 &d11;
> do i = 1 to 5;
> cc[i] = put (nn[i], results.);
> end;
> run;
>
> Thanks for your suggestions, have a nice evening,
>
> Arjen
>
--
To paraphrase G. Santayana, the SAS Macro Facility used by common SAS
programmers is an old mate that gives no pleasure and many headaches,
yet she/he cannot live without it, and resents any aspersions that
strangers may cast on its character
|