|
|
||||||||
MAT2DAT: Create SAS datasets from a SAS matrix catalog fileDownload mat2dat.sasIf you are not prompted to "Save To Disk", then right-click the link and choose "Save Link Target As..." Otherwise, you will need to save the web page to your computer. Make sure you save the mat2dat.sas file as a plain
text file not an htm/html file.
The DAT2MAT SAS macro is a complementary SAS macro to MAT2DAT. Disclaimer: There is no warranty on this software either expressed or implied. This program is released under the terms and conditions of GNU General Public License. About MAT2DAT
Programmer: Dan Blanchette ()
Center for Entrepreneurship and Innovation Duke University's Fuqua School of Business Durham, NC USA Developed at Research Computing at The University of North Carolina at Chapel Hill Date: 10Jul2008 Last updated: 12Mar2009 Create a SAS dataset(s) from a SAS matrix catalog file
%mat2dat( input libref , matrix catalog name ,
output libref );
Description
MAT2DAT creates a SAS dataset out of each matrix in a SAS matrix catalog file. This is especially
useful if you have to transfer the matrix data from one operating system to another since SAS catalog files can only be
read into SAS on the operating system the file was created on where SAS datasets can be read on any operating system.
To convert the SAS datasets back to a SAS catalog file again, use the DAT2MAT SAS macro.
Options
NOTE: The parameters have to be specified in the order of this list.
How to invoke MAT2DAT:
Using the MAT2DAT macro requires that you understand how to use the %include statement
and that you know how to call a SAS macro.
%include "LOCATION AND NAME OF A FILE THAT CONTAINS SAS CODE";For example, if you have copied this file to " C:\SASmacros\", then you
tell SAS about this macro by adding the following line to your SAS program:
%include "C:\SASmacros\mat2dat.sas";The include statement makes SAS aware of the MAT2DAT macro which is in the file mat2dat.sas. You call the macro
by adding this to your code:
%mat2dat( LIB_IN , CATALOG_FILE , LIB_OUT ); Exampleslibname LIB_IN "C:\wherever your matrix_data.sas7bcat file is\"; libname LIB_OUT "C:\wherever you want your datasets stored\"; %include "C:\wherever you put mat2dat.sas\mat2dat.sas"; %mat2dat(LIB_IN , matrix_catalog , LIB_OUT);The above invocation of MAT2DAT expects to find the SAS matrix catalog file: matrix_catalog.sas7bcatin the LIB_IN library. If the matrix catalog file contains the matrices: mat1 mat2 mat3then it will create the SAS datasets: matrix_catalog_mat1.sas7bdat
matrix_catalog_mat2.sas7bdat
matrix_catalog_mat3.sas7bdat
in the LIB_OUT library.
Back to Main Page Questions or comments? Send them to Dan Blanchette () |