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 (June 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 9 Jun 2008 05:58:07 -0400
Reply-To:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:   Re: Saving Data by Groups
Content-Type:   text/plain; charset=ISO-8859-1

I assume, the number of grouüps is dynamic. So the first thing is to extract the group IDs and their number.

proc sort data=dt(keep=id) out=grps nodupkey force; by id; run; %let gno=0; data _null_; set grps; call symput("gno",_n_); call symput("id"!!put(_n_,8 -l),id); run;

now you have all the information for your macro and the internal loops.

%macro doit; %do i=1 %to &gno; ..... the ids you acces by: &&id&i .... the file-numbers for the excel files you generate by ... "file&i..xls" %mend;

Gerhard

On Sun, 8 Jun 2008 22:33:36 -0700, Bill Johnson <belfry2688@MYPACKS.NET> wrote:

>Hi Everyone, > >Long time reader, first time poster. > >I have 1 dataset that contains N groups (in long format) and I'm preparing data to be processed by an external program. > >For each group, I'd like to: > -write their data to an Excel file > -call a macro with that subgroups ID# > >So, if I have 3 groups, I'd like to: > >-save excel to 'file1.xls' >-call myMacro(1) > >iterate... > >-save excel to 'file3.xls' >-call myMacro(3) > >-finish. > >How would I do that? > >Thanks, >Bill


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