proc copy
(2008-06-26 12:48:12)
下一個
data iris;
infile `iris.dat';
do species=1 to 3;
input m1-m4 @;
output;
end;
run;
*-------------------------------------------------------*;
* EXPORT sas datasets for IFLS2 HH
*-------------------------------------------------------*;
libname lib v612 "LOCATION OF LIBRARY OF SAS DATASETS";
libname library v612 "LOCATION OF FORMATS FOR SAS DATASETS";
libname fmt xport "hh97fmt.xpt";
libname bk xport "hh97bk.xpt";
libname b1 xport "hh97b1.xpt";
libname b2 xport "hh97b2.xpt";
libname b3 xport "hh97b3.xpt";
libname b4 xport "hh97b4.xpt";
libname b5 xport "hh97b5.xpt";
* convert formats into common structure so can be exported;
proc format library=library cntlout=lib.hhfmts;
proc copy in=lib out=fmt;
select hhfmts;
* copy each book of modules into a single export file;
proc copy in=lib out=bk;
select htrack ptrack bk_cov bk_sc bk_ar0 bk_ar1 bk_krk
;
* to import use, for example:;
proc copy in=bk out=lib;
* this will select all files from module bk and place the;
* sas datasets in sas library given by ddname=lib;
The export file containing all SAS datasets was created in the same way without the SELECT statement. You may use the SELECT statement when you import the data sets. See PROC COPY in the SAS manual.