Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: fdause


From   "Abrams, Judith" <[email protected]>
To   <[email protected]>
Subject   st: fdause
Date   Fri, 10 Feb 2006 14:36:40 -0500

I am trying to use a large number files that are constructed to be input
easily into SAS. The data are in a .dat file with fields separated by
blanks and there is a .sas file that contains the SAS commands to create
a SAS dataset with variable and value labels. 

We were able to successfully create SAS transport files for the data,
but we cannot import the value labels from formats.xpf. We copied the
macro http://www.sas.com/govedu/fda/macro.html nearly verbatim, but when
we run fdause, we receive the message "formats.xpf is not a valid value
label file."

I am not a SAS user and can't figure out where we're going wrong. I'd
appreciate any help anyone could provide. Below is the log file from
SAS.

Thanks.

Judith Abrams

************************************************************************
***********
...
17   options pageno=1 ;
18   libname WHISAST   'E:\BIOSTATISTICS\Studies\XXX\SASTransport' ;
NOTE: Libref WHISAST was successfully assigned as follows:
      Engine:        V9
      Physical Name: E:\BIOSTATISTICS\Studies\XXX\SASTransport
19
20   %macro expfmts(fmtlib,outfile);
21
22   *-----first create the CNTLOUT= data set from the
catalog------------*;
23   proc format library=&fmtlib cntlout=work.temp;
24   run;
25
26   *-----determine variables not needed for the final transport
file----*;
27   data _null_; set temp end=eof;
28   nend+(end^=start);                 * START/END must be different ;
29   nfuzz+(fuzz^=1e-12 and fuzz^=.);   * FUZZ must be non-default    ;
30   if type='P' then do;               * For PICTURE formats:        ;
31        nprefix+(prefix^=' ');          *   nonblank prefix
;
32        nmult+(mult^=.);                *   multiplier specified
;
33        nfill+(fill^=' ');              *   nonblank fill
;
34        nnoedit+(noedit=1);             *   NOEDIT specified
;
35        end;
36   nsexcl+(sexcl='Y');                * start exclusion specified   ;
37   neexcl+(eexcl='Y');                * end exclusion specified     ;
38   nhlo+(hlo^=' ');                   * high/low/other etc. specd   ;
39   if eof;
40   length todrop $200;
41   *-----build a DROP= option for all pertinent variables----------*;
42   if ^nend     then todrop=trim(todrop)||' '||'END';
43   if ^nfuzz    then todrop=trim(todrop)||' '||'FUZZ';
44   if ^nprefix  then todrop=trim(todrop)||' '||'PREFIX';
45   if ^nmult    then todrop=trim(todrop)||' '||'MULT';
46   if ^nfill    then todrop=trim(todrop)||' '||'FILL';
47   if ^nnoedit  then todrop=trim(todrop)||' '||'NOEDIT';
48   if ^nsexcl   then todrop=trim(todrop)||' '||'SEXCL';
49   if ^neexcl   then todrop=trim(todrop)||' '||'EEXCL';
50   if ^nhlo     then todrop=trim(todrop)||' '||'HLO';
51   if todrop^=' '
52   then todrop='DROP='||todrop;
53
54   *-----emit the requested DROP= option---------------------------*;
55   call symput('dropopt',trim(todrop));
56   run;
57
58   *-----provide a LIBNAME statement for the specified
file-------------*;
59   libname yyy xport "&outfile.";
60
61   *-----create the transport file, dropping appropriate
variables------*;
62   data yyy.formats; set temp(&dropopt.);
63        run;
64
65   *-----clear the libref now that the file is
written------------------*;
66   libname yyy clear;
67
68   *-----ensure the temporary data set is
deleted-----------------------*;
69   proc datasets dd=work; delete temp; quit;
70
71   %mend;
72
%expfmts(WHISAST,E:\BIOSTATISTICS\Studies\XXX\SASTransport\formats.xpf);

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.09 seconds
      cpu time            0.06 seconds



------
Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information.  If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure, copying, or distribution of the contents of this email and/or any materials contained in any attachments is prohibited.  If you have received this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index