Date: Mon, 6 Jul 2009 11:05:24 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: SAS macro
In-Reply-To: <1af8f9fe-0c8d-4dd7-9003-57ff82d7be73@s1g2000prd.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
No macro needed.
data all;
set janfile(in=a) febfile(in=b) marfile(in=c);
if a then month='Jan';
else if b then month='Feb';
else if c then month='Mar';
run;
If you have 9.2 there is INDSNAME data set option that is even easier.
-Joe
On Mon, Jul 6, 2009 at 10:57 AM, Melodyp <pearsonmelody@gmail.com> wrote:
> I have 5 dataset contains same variables with different months
> information, month is not a variable in the file.
>
> I need to append these file together and want to also keep the
> information that which observations come from which file, so I have to
> create an additional filed for each file using the following code:
>
> data mylib.REPORT_JAN_09_new;
> set mylib. REPORT_JAN_09;
> month=Jan;
>
> data mylib.REPORT_Feb_09_new;
> set mylib. REPORT_Feb_09;
> month=Jan;
> then do it for March... July, it's quit laboring, is there anyway I
> can using a macro do it in batch?
>
> Thank you,
>
> Melody
>
|