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 (March 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 13 Mar 1997 08:53:35 -0800
Reply-To:     mackce@dshs.wa.gov
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Curtis Mack <mackce@DSHS.WA.GOV>
Organization: Washington State Department of Social and Health Services
Subject:      Re: symbolic constant in data ?
Content-Type: text/plain; charset=us-ascii

Arthur Ellen wrote: > > I'm running SAS on Windows 3.1 v 6.08(or most current). > > Is there a way to use symbolic constants in a data step with > arrays and do: > > data new; > n=5; /* symbolic constant */ > array score(n) score1-score5 (1, 2, 3, 4, 5); > do i = 1 to n; > . > . > > . > end; > > I'd like to set n for the array or arrays to a number as > well as use it in the loop without having to specify it in each > place. > > tia > > art

Congratulations, You have just moved into the world of SAS macros. You may want to read up on the subject, but your sample would look like this:

%LET N = 5; data new; array score(&n) score1-score5 (1, 2, 3, 4, 5); do i = 1 to &n; . .

. end;

-- Curtis E. Mack Washington State Dept. of Social and Health Services Research and Data Analysis mackce@dshs.wa.gov


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