Date: Fri, 31 Aug 2007 09:37:06 -0400
Reply-To: Lingqun Liu <lingqun@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lingqun Liu <lingqun@GMAIL.COM>
Subject: Re: Merge different months' data
In-Reply-To: <7fae10f00708300855g66abb78dyd1788621ed439603@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Your production code could be:
%macro combine(from,to);
data _null_;
t_pair = INTCK('month',&from,&to)-1;
do pair=0 to t_pair;
start=intnx('month',&from,pair);
end=intnx('month',&from,pair+1);
dsn1='sale'||put(start,yymmn6.);
dsn2='nosale'||put(end,yymmn6.);
call execute(' data '|| dsn1||'_'||dsn2||';
set '|| dsn1 ||' '||dsn2 ||';
by acc_id; run;'
);
end;
run;
%mend;
%combine('01nov2006'd,'01feb2007'd);
|