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 (May 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 14 May 2005 10:29:42 -0400
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: Generating different excel files for each group
Comments:   To: Yam Kan <ysk.kan@GMAIL.COM>

Yamini,

Would something like the following help?

data one; input a $ b; cards; a 1 a 2 a 3 b 4 b 5 b 6 ; run; %global valuelist; proc sql; select distinct(a) into: valuelist separated by " " from one; quit; %put valuelist= &valuelist; %macro splitfile; %let i=1; %do %while (%scan(&valuelist.,&i.,' ')^=); call symput("currentvalue",%scan(&valuelist.,&i.,' '); data part; set one; %put &currentvalue.; if a eq "&currentvalue."; c=''; /* create new blank variable c */ d=''; /* create new blank variable d */ run; PROC EXPORT DATA= WORK.part OUTFILE= "c:\test&currentvalue..xls" DBMS=EXCEL REPLACE; RUN; %let i=%eval(&i+1); %end; %mend splitfile; %splitfile

Art -------- On Fri, 13 May 2005 13:33:22 -0700, ysk <ysk.kan@GMAIL.COM> wrote:

>Thanks for the macro. >I am still trying to expand on that. >But i am not sure if it will help me generate seperate xls file for >each group value...bcaz my group value are strings. >I realized that i cannot use a list of string values in %do like do >i='a' 'b' 'c'...


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