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 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 17 Feb 2009 01:28:28 -0800
Reply-To:   Chris Jones <chrisj75@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Chris Jones <chrisj75@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   Re: Macro & Array help please......
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On 17 Feb, 08:51, Metricsdude <bsj_ad...@hotmail.com> wrote: > On 16 Feb, 16:57, chang_y_ch...@HOTMAIL.COM (Chang Chung) wrote: > > > > > > > On Mon, 16 Feb 2009 08:33:01 -0800, Metricsdude <bsj_ad...@HOTMAIL.COM> > > wrote: > > ... > > > >Any advice would be much appreaciated as i would like to learn the > > >best way to do this as i want to add in more complexity to this.... > > > hi, > > so, the goal is to create a data set, mergelookup, which has last month's > > dates as observations, each date repeated six times, each time with a > > different bill code -- GR1, GR2,..., GR6. If that is the goal, then I think > > there are much easier ways. here is one. hth. > > cheers, > > chang > > > %*-- first and last day of last month --*; > > %let bdt = %sysfunc(intnx(month,%sysfunc(date()),-1,b),date9.); > > %let edt = %sysfunc(intnx(month,%sysfunc(date()),-1,e),date9.); > > > /* create the mergelookup table */ > > data lookup; > > attrib billcode length=$3 day format=date9.; > > do billcode = "GR1", "GR2", "GR3", "GR4", "GR5", "GR6"; > > do day = "&bdt"d to "&edt"d; > > output; > > end; > > end; > > run; > > Sorry i have another probably stupid question... > > I now want to repeat all these observations for various market > participants held in another dataset (called MAP) which will vary each > month would this now be the appropriate time to use a macro or do you > have another simple solution that could be applied????- Hide quoted text - > > - Show quoted text -

Simply modify the previous example, get each unique participant, create a macro variable and iterate over it (assumes a length of 6 for participant in MAP dataset */

proc freq data=map noprint ; table participant / out=f_part ; run ;

proc sql ; select quote(particpant) into :PART_LIST separated by ',' from f_part ; quit ;

data lookup; attrib part $6. billcode length=$3 day format=date9.; do part = &PART_LIST ; do billcode = "GR1", "GR2", "GR3", "GR4", "GR5", "GR6"; do day = "&bdt"d to "&edt"d; output; end; end; end ; run;


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