Date: Mon, 6 Jul 2009 10:21:12 -0700
Reply-To: Melodyp <pearsonmelody@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Melodyp <pearsonmelody@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: SAS macro
Content-Type: text/plain; charset=ISO-8859-1
On Jul 6, 12:05 pm, snoopy...@GMAIL.COM (Joe Matise) wrote:
> 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 <pearsonmel...@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- Hide quoted text -
>
> - Show quoted text -
Thank you Joe, this is really a great help!!!
|