Deepu
you say you "can view the SAS files", so I'll assume that these are are catalog entries of type SOURCE. (i would not expect to view the contents of a compiled macro).
The following CODE assigns two "aggregate storage locations". First pointing at your catalog, Second is pointing at a folder in which you want to write the SAS files.[pre]filename sfrom catalog 'libname.catname' ;
filename sto 'your destination path\' ;
* now create a dataset listing all source entries in the catalog ;
proc sql noprint ;
create table work.sources as
select objname from dictionary.catalogs
where libname='LIBNAME' and memname='CATNAME'
and objtype='SOURCE' ;
quit ;
data _null_ ; * now do the copies ;
set work.sources ;
length from_obj to_textf $80 ;
retain sto "%sysfunc(pathname(sto))" ;
to_textf = cats( sto,'\', objname, '.sas' );
from_obj = cats( 'libname.catname.', objname, '.source' ) ;
putLog 'reading from ' from_obj +1 'to write ' to_textf ;
eof_cat_entry = . ;
infile dum device=catalog filevar= from_obj end= eof_cat_entry ;
file dmy filevar= to_textf ;
do lines=0 by 1 while( not eof_cat_entry ) ;
input ;
L= length( _infile_ ) ;
put _infile_ $varying256. L ;
end ;
putlog 'wrote ' lines +1 'lines.' ;
run ; [/PRE]
On testing, I couldn't make the FILEVAR= feature support "aggregate storage location" filerefs. (you may be more sucessful).
a piece of sas history convenience :: in the syntax [pre] %include sfrom(program1) ;[/pre]"sfrom" is an aggregate storage location also known as a logical reference that points to a folder, directory or catalog, or pds (subject to the platform terminology).
It serves the purpose of abbreviating the syntax (logical reference is allowed only an 8-wide SAS name) and being defined once and used many times, the logical reference reduces the number of places referring to physical paths.[pre] sfrom(program1) [/pre]refers to a program file named program1.sas or program1.source, or program1.catams or just "program1" (depending on the platform and certain system options) in that aggregate storage location. Because of this convenience, an aggregate storage locations often called a "program library".
//end of history
fortunately, the base sas language provides the functions and operators which enable the code above to convert from logical reference to physical reference.