Date: Fri, 12 Nov 1999 17:07:41 -0500
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Coverting Unix dataset into PC dataset
Content-Type: text/plain; charset=US-ASCII
Since transport libraries and CPORT containers are sequential,
the FTP access method can be used to move them from the old
machine to the new.
This can reduce a three-step process to two. Instead of
convert, transfer, convert back
it can be either
convert with remote output, convert back
or
convert, convert back with remote input.
> * macro to convert as SAS dataset to export format*/
> options mprint;
>
> %macro cnvtdat(xlib=,xdata=);
> libname indat "&xlib";
> libname outdat xport "&xlib.&xdata..xpt";
>
> data outdat.&xdata;
> set indat.&xdata;
> run;
>
> %mend cnvtdat;
>
>
> %cnvtdat(xlib=home/greg/mydata/,xdata=myfile);
>
>
> Notice that I make use of the xport engine on the libname statement. And
> putting th code in a macro makes it a little more flexible since I can
> change the library location and/or file. To add even more flexibility,
> draw a distinction between the input library location and output library
> location by adding an addtional macro parameter like the following:
>
> %macro cnvtdat(inlib=,outlib=,xdata=);
> libname indat "&inlib";
> libname outdat xport "&outlib.&xdata..xpt";
>
> data outdat.&xdata;
> set indat.&xdata;
> run;
>
> %mend cnvtdat;
>
> %cnvtdat(inlib=home/greg/mydata, outlib=/home/dest/data/,xdata=myfile);
>
> Also remember that when you move your transport/xport datasets, set FTP
> as binary. AND finally, the listed code sets one dataset per xport file.
> With a little manipulation of the code, you can add more datasets to an
> xport file.
>
>
> Good Luck, CD.
> -----------------------------------------
> Gregory Cox
> Westat
> coxg1@westat.com
|