LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 1998, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 6 Feb 1998 15:55:03 -0500
Reply-To:     Michael Glasser <mglasser@DEANS.UMD.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Michael Glasser <mglasser@DEANS.UMD.EDU>
Organization: University of Maryland
Subject:      Writing to two different output files
Content-Type: text/plain; charset=us-ascii

Does anyone have any suggestions how I can write observations to a SAS dataset and in the same step, conditionally write some data to another dataset. I am reading an external file into a SAS dataset and would like to report any errors I encounter to another SAS dataset. There can be multiple error records created from one observation. The first dataset would contain all the fields in my observations. The second dataset, my error file, would contain one or two fields and an error message as a character literal. My hope would also be to append to this error file as I read in other SAS datasets.

According to the manuals, this won't work, but I am looking for something like ...

DATA FILE1 ERROR1; INFILE X; INPUT A B C D E F; IF A > 1 THEN OUTPUT ERROR1 'File X: ' A F 'A is over 1'; IF B > 1 THEN OUTPUT ERROR1 'File X: ' B F 'B is over 1'; OUTPUT FILE1;

DATA FILE2 ERROR1; INFILE Y; INPUT L M N O P; IF L > 1 THEN OUTPUT ERROR1 'File Y: ' L P 'L is over 1'; IF M > 1 THEN OUTPUT ERROR1 'File Y: ' M P 'M is over 1'; OUTPUT FILE2;

Thanks in advance for any help you can provide. -- Mike Glasser

Academic Data Systems University of Maryland mglasser@deans.umd.edu


Back to: Top of message | Previous page | Main SAS-L page