Date: Fri, 18 Apr 2008 11:36:15 -0700
Reply-To: Cristian Gugiu <crisgugiu@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Cristian Gugiu <crisgugiu@YAHOO.COM>
Subject: Re: Appending multiple files w/o knowing filenames
Content-Type: text/plain; charset=us-ascii
I combined two suggestions into the following solution that worked really well. Thank you all. -Cristian
%let memlist=;
proc sql;
select cats(libname,'.',memname) into :memlist separated by ' '
from dictionary.members
where upCase(MemName) like '%_MOMENTS'
;
quit;
run;
data all;
set &memlist ;
run;
----- Original Message ----
From: Ed Heaton <EdHeaton@westat.com>
To: P. Cristian Gugiu <crisgugiu@YAHOO.COM>; SAS-L@LISTSERV.UGA.EDU
Sent: Friday, April 18, 2008 2:21:01 PM
Subject: RE: Appending multiple files w/o knowing filenames
Proc contents data=_all_ out=foo noPrint ;
Run ;
Proc sql noPrint ;
Select distinct MemName into :datasets separated by ' '
from foo
where upCase(MemName) like '%_MOMENTS'
;
Drop table foo ;
Quit ;
Data all ;
Set &datasets ;
Run ;
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1650 Research Boulevard, TB-286, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 294-2085
mailto:EdHeaton@Westat.com http://www.Westat.com
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of P. Cristian Gugiu
Sent: Friday, April 18, 2008 2:17 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Appending multiple files w/o knowing filenames
Clarifying my question
I have a folder, say "D:\mydata\" that contains several files, e.g.,
ATE_moments, CWO_moments, DE_Teachers_moments, etc. (all the files end
in
_moments) These files have exactly the same variables, N, Mean,
Variance, Skewness, etc. There are also catalog files in this folder
that contain the QQ Plots of the data contained in this folders. (These
files end in
_QQplots) I'm not concerned about these files for now, although a future
question may be how do I merge these catalogs into a master catalog.
For now, I am just interested in appending the _moments datasets into a
master dataset. I know how to do it by SETing each file but got a little
lazy and did not want to type all the file names. I wanted to know if
SAS could programatically append all the files found in a location
without me specifying the actual name of each file.
Cristian
|