home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / sasl / 3402 < prev    next >
Encoding:
Text File  |  1992-07-22  |  4.5 KB  |  136 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!HILBERT.MATHS.UTAS.EDU.AU!MCPHERS
  3. X-Mailer: ELM [version 2.2 PL11]
  4. Message-ID: <9207230551.AA14495@hilbert.maths.utas.edu.au>
  5. Newsgroups: bit.listserv.sas-l
  6. Date:         Thu, 23 Jul 1992 15:51:31 EST
  7. Reply-To:     "D. Glen McPherson" <mcphers@HILBERT.MATHS.UTAS.EDU.AU>
  8. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  9. From:         "D. Glen McPherson" <mcphers@HILBERT.MATHS.UTAS.EDU.AU>
  10. Subject:      storing and retrieving formats.
  11. Lines: 123
  12.  
  13. I am having difficulties retrieving formats which have been permanently stored.
  14. The simplest way to pose my problem is through an example. Below is a program
  15. which stores a format and attempts to retrieve it (unsuccessfully). The log
  16. output is included following the program. I would be appreciative of any help
  17. to establish what I am doing wrong, and how to correct my mistake.
  18.  
  19. With thanks,  Glen
  20.  
  21. ******************************************************************
  22. * PROGRAMME - CONSTRUCTS FORMATS AND STORES THEM PERMANENTLY
  23. *             THEN ATTEMPTS TO USE THEM (UNSUCCESSFULLY!)
  24. *******************************************************************;
  25.  
  26. libname problem 'e:\sma352\sasdata';
  27.  
  28. data dset1;
  29.   infile 'e:\sma352\rawdata\a6x1.dat';
  30.   input freq @@;
  31.   label freq='Frequency';
  32.  
  33. data dset2;
  34.   do study = 1 to 8;
  35.      do cancer = 'no', 'yes';
  36.         do smoker = 'no', 'yes';
  37.            output;
  38.          end;
  39.       end;
  40.    end;
  41.   label cancer='Lung cancer?'
  42.         smoker = 'Smoker?';
  43.  
  44. proc format library=problem;
  45.   value $ fcancer 'no' = 'Control'
  46.                 'yes' = 'Lung cancer';
  47.   value $ fsmoker 'no' = 'Non-smoker'
  48.                 'yes' = 'Smoker';
  49.  
  50. run;
  51.  
  52.  
  53. data problem.a6x1;
  54.   merge dset2 dset1;
  55.  
  56. libname library 'e:\sma352\sasdata';
  57. proc print data=problem.a6x1;
  58.   id cancer smoker;
  59.   var freq;
  60.   format cancer fcancer.;
  61.   format smoker fsmoker.;
  62.   title 'Data for Assignment 6.1';
  63.  
  64. run;
  65.   482    ******************************************************************
  66.   483    * LOG OUTPUT
  67.   484    *******************************************************************;
  68.  
  69.   485
  70.   486    libname problem 'e:\sma352\sasdata';
  71.   487
  72.   488    data dset1;
  73.   489      infile 'e:\sma352\rawdata\a6x1.dat';
  74.   490      input freq @@;
  75.   491      label freq='Frequency';
  76.   492
  77.   493    data dset2;
  78. NOTE: The infile 'e:\sma352\rawdata\a6x1.dat' is file
  79.       E:\SMA352\RAWDATA\A6X1.DAT.
  80. NOTE: 8 records were read from the infile E:\SMA352\RAWDATA\A6X1.DAT.
  81.       The minimum record length was 10.
  82.       The maximum record length was 14.
  83. NOTE: SAS went to a new line when INPUT statement reached past the end of a
  84.       line.
  85. NOTE: The data set WORK.DSET1 has 32 observations and 1 variables.
  86. NOTE: The DATA statement used 2.00 seconds.
  87.   494      do study = 1 to 8;
  88.   495         do cancer = 'no', 'yes';
  89.   496            do smoker = 'no', 'yes';
  90.   497               output;
  91.   498             end;
  92.   499          end;
  93.   500       end;
  94.   501      label cancer='Lung cancer?'
  95.   502            smoker = 'Smoker?';
  96.   503
  97.   504    proc format;
  98. NOTE: The data set WORK.DSET2 has 32 observations and 3 variables.
  99. NOTE: The DATA statement used 2.00 seconds.
  100.   505      value $ fcancer 'no' = 'Control'
  101.   506                    'yes' = 'Lung cancer';
  102. NOTE: Format $FCANCER has been output.
  103.   507      value $ fsmoker 'no' = 'Non-smoker'
  104.   508                    'yes' = 'Smoker';
  105. NOTE: Format $FSMOKER has been output.
  106.   509
  107.   510    run;
  108. NOTE: The PROCEDURE FORMAT used 2.00 seconds.
  109.   511
  110.   512
  111.   513    data problem.a6x1;
  112.   514      merge dset2 dset1;
  113.   515
  114.   516    proc print data=problem.a6x1;
  115. NOTE: The data set PROBLEM.A6X1 has 32 observations and 4 variables.
  116. NOTE: The DATA statement used 2.00 seconds.
  117.   517      id cancer smoker;
  118.   518      var freq;
  119.   519      format cancer fcancer.;
  120. ERROR: Format FCANCER not found or couldn't be loaded.
  121.   520      format smoker fsmoker.;
  122.   521      title 'Data for Assignment 6.1';
  123.   522
  124.   523    run;
  125. NOTE: The SAS System stopped processing this step because of errors.
  126. NOTE: The PROCEDURE PRINT used 2.00 seconds.
  127.   524      439
  128.  
  129. --
  130.  ---------------------------------------------------------------------------
  131. |  Glen McPherson            |                                   |  _--_|\  |
  132. |  Department of Mathematics |-----------------------------------| /      \ |
  133. |  University of Tasmania    |               E-Mail:             | \_.--._/ |
  134. |  Australia.                | mcphers@hilbert.maths.utas.edu.au |       *  |
  135.  ---------------------------------------------------------------------------
  136.