Date: Thu, 26 Sep 2002 14:43:41 -0400
Reply-To: Raj <raj5@SOFTHOME.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Raj <raj5@SOFTHOME.NET>
Subject: Re: SAS Transport file
Thanks Bob.
The macro was very useful. I just had to modify the where statement in
PROC SQL to:
where upcase(libname)="%upcase(&INLIB)";
Raj
On Wed, 25 Sep 2002 16:45:18 -0400, Robert Abelson <rabelson@KAI-
RESEARCH.COM> wrote:
>Here's a macro I wrote to copy all of the files in a library, plus the
>format catalog, to individual XPT filesl
>
>/**************************************************************************
*
>***/
>/* Program Name: writexpt.sas
>*/
>/* Programmer: Robert Abelson
>*/
>/* Compound: EN3231
>*/
>/* Protocol:
>*/
>/* Start Date: 09Sep2002
>*/
>/* End Date:
>*/
>/* Modifications:
>*/
>/* Parameters: INLIB - libref of input data
>*/
>/* FMTLIB - libref of format catalog
>*/
>/* OUTDIR - directory where xpt files will be written
>*/
>/* Input: SAS library
>*/
>/* Output: SAS transport datasets, 1 dataset per XPT file
>*/
>/* Description:
>*/
>/**************************************************************************
*
>***/
>
>%macro writexpt(inlib=,fmtlib=LIBRARY,outdir=);
>
> proc sql noprint;
> select distinct memname into :dsnames separated by " "
> from dictionary.tables
> where upcase(libname)="&INLIB";
>
> select count(*) into :n from
> (select distinct memname
> from dictionary.tables
> where upcase(libname)="&INLIB");
> quit;
>
> %do i=1 %to &n;
>
> %let currdsn=%scan(&dsnames,&i);
>
> libname OUTLIB xport "&outdir\&currdsn..xpt";
>
> proc copy in=&INLIB out=OUTLIB;
> select &currdsn;
> run;
>
> %end;
>
> libname OUTFMT xport "&outdir\formats.xpt";
>
> proc format library=&fmtlib cntlout=OUTFMT.formats;
> run;
>
>%mend writexpt;
>
>
>HTH.
>
>Bob Abelson
>KAI
>6001 Montrose Rd.
>Suite 920
>Rockville, MD 20852
>T: 301-770-2730
>F: 301-770-4183
>rabelson@kai-research.com
>
>"Anyone who cannot cope with mathematics is not fully human. At best he is
a
>tolerable subhuman who has learned to wear shoes, bathe, and not make
messes
>in the house."
>- Robert A. Heinlein
>
>
>
>> -----Original Message-----
>> From: Raj [SMTP:raj5@SOFTHOME.NET]
>> Sent: Wednesday, September 25, 2002 3:45 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: SAS Transport file
>>
>> Hello everyone,
>>
>> I have a question regarding the SAS transport file. I am trying to
create
>> V5 SAS transport files (multiple .xpt files for each dataset) to comply
>> with the FDA guidelines of electronic submission of data.
>>
>> When I do following, I get single .xpt file. How can I create
>> multiple .xpt files for each dataset, and that is V5 compatible as FDA
>> requires.
>>
>> libname xpt xport 'I:\sasdata\transpt.xpt';
>> libname in 'I:\sasdata\Raw';
>>
>> proc copy in=in out=xpt memtype=data;
>> run;
>>
>> Thanks for your assistance.
>> Raj
|