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 (February 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 5 Feb 2002 15:51:00 -0500
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: character %DO condition
Comments: To: Robert Saunders <robert.c.saunders@VANDERBILT.EDU>
Content-Type: text/plain

> From: Robert Saunders [mailto:robert.c.saunders@VANDERBILT.EDU] > It looks like you can have a do-loop process through a set of > character > values, however when I try to do this in a %DO SAS tells me > that a numeric > value is required. Here's a snippet of the code that shows > what I want to do: > %macro loop;

%let dset1=A; %let dset2=B; %let dset3=C; %LET DIM_DSET = 3;

> %*do i = 'a' %to 'e'; %DO I = 1 %TO &DIM_DSET.;

> /* I also tried: %do i = 'a','b','c','d','e' */ >* proc sort data=dset&i;

proc sort data=&&DSET&I.;

> by idvar; > run; > %end; > %mend loop; > %loop;

see also: SUGI 22: 1997 San Diego CA Coder's Corner 80 %ARRAY %ARRAY: construction and usage of arrays of macro variables http://www2.sas.com/proceedings/sugi22/CODERS/PAPER80.PDF

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: Win_Pro Ver: 8.2 ---> cheerful provider of TESTED SAS code from the Clue?Gee!Wrx !*! <--- If you always try to be logical, you probably won't ever have much sorrow, or much fun. -- Ashleigh Brilliant pot-shot #4438


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