home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!HILBERT.MATHS.UTAS.EDU.AU!MCPHERS
- X-Mailer: ELM [version 2.2 PL11]
- Message-ID: <9207230551.AA14495@hilbert.maths.utas.edu.au>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 23 Jul 1992 15:51:31 EST
- Reply-To: "D. Glen McPherson" <mcphers@HILBERT.MATHS.UTAS.EDU.AU>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: "D. Glen McPherson" <mcphers@HILBERT.MATHS.UTAS.EDU.AU>
- Subject: storing and retrieving formats.
- Lines: 123
-
- I am having difficulties retrieving formats which have been permanently stored.
- The simplest way to pose my problem is through an example. Below is a program
- which stores a format and attempts to retrieve it (unsuccessfully). The log
- output is included following the program. I would be appreciative of any help
- to establish what I am doing wrong, and how to correct my mistake.
-
- With thanks, Glen
-
- ******************************************************************
- * PROGRAMME - CONSTRUCTS FORMATS AND STORES THEM PERMANENTLY
- * THEN ATTEMPTS TO USE THEM (UNSUCCESSFULLY!)
- *******************************************************************;
-
- libname problem 'e:\sma352\sasdata';
-
- data dset1;
- infile 'e:\sma352\rawdata\a6x1.dat';
- input freq @@;
- label freq='Frequency';
-
- data dset2;
- do study = 1 to 8;
- do cancer = 'no', 'yes';
- do smoker = 'no', 'yes';
- output;
- end;
- end;
- end;
- label cancer='Lung cancer?'
- smoker = 'Smoker?';
-
- proc format library=problem;
- value $ fcancer 'no' = 'Control'
- 'yes' = 'Lung cancer';
- value $ fsmoker 'no' = 'Non-smoker'
- 'yes' = 'Smoker';
-
- run;
-
-
- data problem.a6x1;
- merge dset2 dset1;
-
- libname library 'e:\sma352\sasdata';
- proc print data=problem.a6x1;
- id cancer smoker;
- var freq;
- format cancer fcancer.;
- format smoker fsmoker.;
- title 'Data for Assignment 6.1';
-
- run;
- 482 ******************************************************************
- 483 * LOG OUTPUT
- 484 *******************************************************************;
-
- 485
- 486 libname problem 'e:\sma352\sasdata';
- 487
- 488 data dset1;
- 489 infile 'e:\sma352\rawdata\a6x1.dat';
- 490 input freq @@;
- 491 label freq='Frequency';
- 492
- 493 data dset2;
- NOTE: The infile 'e:\sma352\rawdata\a6x1.dat' is file
- E:\SMA352\RAWDATA\A6X1.DAT.
- NOTE: 8 records were read from the infile E:\SMA352\RAWDATA\A6X1.DAT.
- The minimum record length was 10.
- The maximum record length was 14.
- NOTE: SAS went to a new line when INPUT statement reached past the end of a
- line.
- NOTE: The data set WORK.DSET1 has 32 observations and 1 variables.
- NOTE: The DATA statement used 2.00 seconds.
- 494 do study = 1 to 8;
- 495 do cancer = 'no', 'yes';
- 496 do smoker = 'no', 'yes';
- 497 output;
- 498 end;
- 499 end;
- 500 end;
- 501 label cancer='Lung cancer?'
- 502 smoker = 'Smoker?';
- 503
- 504 proc format;
- NOTE: The data set WORK.DSET2 has 32 observations and 3 variables.
- NOTE: The DATA statement used 2.00 seconds.
- 505 value $ fcancer 'no' = 'Control'
- 506 'yes' = 'Lung cancer';
- NOTE: Format $FCANCER has been output.
- 507 value $ fsmoker 'no' = 'Non-smoker'
- 508 'yes' = 'Smoker';
- NOTE: Format $FSMOKER has been output.
- 509
- 510 run;
- NOTE: The PROCEDURE FORMAT used 2.00 seconds.
- 511
- 512
- 513 data problem.a6x1;
- 514 merge dset2 dset1;
- 515
- 516 proc print data=problem.a6x1;
- NOTE: The data set PROBLEM.A6X1 has 32 observations and 4 variables.
- NOTE: The DATA statement used 2.00 seconds.
- 517 id cancer smoker;
- 518 var freq;
- 519 format cancer fcancer.;
- ERROR: Format FCANCER not found or couldn't be loaded.
- 520 format smoker fsmoker.;
- 521 title 'Data for Assignment 6.1';
- 522
- 523 run;
- NOTE: The SAS System stopped processing this step because of errors.
- NOTE: The PROCEDURE PRINT used 2.00 seconds.
- 524 439
-
- --
- ---------------------------------------------------------------------------
- | Glen McPherson | | _--_|\ |
- | Department of Mathematics |-----------------------------------| / \ |
- | University of Tasmania | E-Mail: | \_.--._/ |
- | Australia. | mcphers@hilbert.maths.utas.edu.au | * |
- ---------------------------------------------------------------------------
-