[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: create one dataset out of multiple access tables
From:       Sdlentertd <sdlentertd () GMAIL ! COM>
Date:       2010-02-26 16:21:13
Message-ID: 36ce86c3-9154-42a1-b0de-ed8bf4974a02 () 33g2000yqj ! googlegroups ! com
[Download RAW message or body]

On Feb 25, 8:55 pm, Tom Abernathy <tom.aberna...@gmail.com> wrote:
> If the tables are named with sequential numberic suffixes then with
> SAS 9.2 you shoule be able to use the SET statement with a range of
> names.
>
> libname whatever access "file.mdb";
>
> data all;
>   set whatever.table1 - whatever.table100 ;
> run;
>
> On Feb 25, 8:07 pm, snoopy...@GMAIL.COM (Joe Matise) wrote:
>
>
>
> > Sure.  Is there a consistency of naming in the tables?
>
> > In general, assuming you have PC FILES licensed on your (Windows) machine,
> > you can do :
>
> > libname whatever access "file.mdb";
>
> > At that point depending on the version of SAS you have and the naming scheme
> > there are different ways you can proceed.
>
> > If the naming scheme is TABLE1 - TABLE100, you can use a variety of DO loops
> > such as:
>
> > %macro load_tables;
> > %do i = 1 %to 100;
> > whatever.table&i
> > %end;
> > %mend load_tables;
>
> > data stuff;
> > set %load_tables; ;
> > run;
>
> > If they're huge, it might be better to use PROC APPEND in a similar fashion.
>
> > If they are named inconsistently, you can use PROC SQL to get into the
> > contents of the access table, something similar to:
> > proc sql;
> > select cats('whatever.',memname) into :tables separated by ' '
> >   from dictionary.tables
> >   where libname='WHATEVER';
> > quit;
> > and then
> > data test;
> > set &tables;
> > run;
> > or similar with proc append.
>
> > If you have 9.2 you can also use the : operator ('starts with') if they are
> > all named something starting with the same letters:
>
> > data test;
> > set whatever.table:;
> > run;
>
> > And a few dozen more options :)
>
> > -Joe
>
> > On Thu, Feb 25, 2010 at 4:25 PM, Sdlentertd <sdlente...@gmail.com> wrote:
> > > I have an Access Database with 100 tables with exact same fields, only
> > > values are different.  I need to create one big SAS dataset out of
> > > those 100 tables.
> > > is there a way to do it without 200 lines of repetitive code?
>
> > > Thank you- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

All the tables have different names but all of them start with the
Underscore ( _ )  The layout of all tables is the same
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic