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 (July 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 17 Jul 2003 15:27:22 -0400
Reply-To:   "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:   Re: processing question
Comments:   cc: Shannon <shannon_ritter@ALUMNI.ALBANY.EDU>
Content-Type:   text/plain

> From: Shannon [mailto:shannon_ritter@ALUMNI.ALBANY.EDU] > Suppose you want to perform a similar operation on a group of > variables in the same data set. I usually do this with a > macro do loop. In the current situation I run a proc contents > and then subset based on a substring in the output NAME > variable. This substring then becomes necessary in and after > the macro do loop. The result of the do loop is a data set > that is 1-1 merged with the contents > output(subsetted) data set. The question is should I create > the substring variable before the do loop (which would > involve an extra data step) or after the do loop (in a data > step I need anyway)? In the latter case I actually end up > creating the substring 3 times, once for the first subsetting > (with a where option on the out= data set), once in the macro > do loop (using %substr) and the third time for keeps after > the do loop (by assignment). In the former case I need an > extra data step.

this sounds similar to an algorithm I use.

I recommend creating your necessary variable -- which name is the prefix of the group -- as early as possible which I think, according to your description, 'involves an extra data step'.

In this preprocessing data step you can completely declare your data structure which is always a Good Thing.

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov

Your task is simple: remove the difference between how things should be and how they really are. -- Ashleigh Brilliant pot-shot #4247

... as early as possible.


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