MAT2DAT
Create SAS datasets from a SAS matrix catalog file
If you want to use MAT2DAT, then feel free to download load it here:
Download mat2dat.sas
If 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 (dan_blanchette@unc.edu)
The Carolina Population Center
The University of North Carolina
Chapel Hill, 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
The Carolina Population Center
The University of North Carolina
Chapel Hill, 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.
|
Parameters
|
Explanation
|
|
(1st)
input_libref |
The libref where the input SAS matrix catalog file exists. |
|
(2nd)
catalog_name |
The name of the input SAS matrix catalog file (without the file extension: " .sas7bcat").
|
|
(3rd)
output_libref |
The libref where the output SAS dataset will be saved to. |
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 );
Examples
libname 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.


