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 (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 4 Sep 2006 09:42:39 -0700
Reply-To:   Arjen <a.benedictus@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arjen <a.benedictus@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   making code generic
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset="iso-8859-1"

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


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