Date: Mon, 10 Feb 1997 18:30:14 PST
Reply-To: TWB2%Rates%FAR@GO50.COMP.PGE.COM
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: TWB2%Rates%FAR@GO50.COMP.PGE.COM
Subject: Re: Appending to an external file
Steve, There is always another way! That is the beauty and horror of SAS.
Since you mention ASCII, I'll assume you work on one of the bitty boxes (unix or
Windoze). How about using the MOD option of the FILE statement (on one of my
personal favorite big iron monsters, you would code MOD in the JCL)?
There is really no reason to do this in multiple datasets. I do not understand
what you mean by ten year segments, so I will guess you mean you want years 0-9
in one row, years 10-19 in the next row, etc. Try:
DATA _NULL_;
SET MYDISK.SOMEDATA(KEEP=ONLYVAR)
MYDISK.SOMEMORE(KEEP=ONLYVAR)
MYDISK.ANOTHER(KEEP=ONLYVAR);
FILE 'C:\FLATFILE\ALLYEARS.TXT';
RETAIN YEAR0-YEAR9 COUNT 1;
ARRAY YEAR YEAR0-YEAR9;
YEAR(COUNT)=ONLYVAR;
COUNT=COUNT+1;
IF COUNT EQ 10 THEN DO;
PUT YEAR0-YEAR9 (5.0 +(-1) ',');
DO ZAP=1 TO 10;
YEAR(ZAP)=.;
END;
COUNT=1
END;
RUN;
If I had more time, I'd set the array bounds to 0-9 instead of 1-10.
Tim Berryhill - Contract Programmer and General Wizard
TWB2@PGE.COM or http://www.aartwolf.com/twb.html
Frequently at Pacific Gas & Electric Co., San Francisco
The correlation coefficient between their views and
my postings is slightly less than 0
----------------------[Reply - Original Message]----------------------
Sent by:Steven Dolan <steven.dolan@BEA.DOC.GOV>
I am just starting out at this, so I beg you excuse me if this is a basic
question, but I have read TFM, and find no help there.
I have several SAS datasets, each of which contains 30 years of data that I
would like to output to a single ASCII file, in ten year segments. I had
thought to do it using multiple data steps, each outputting to the same file,
but the file is renewed each time and I find no "append" option. Am I missing
it? or is there another way?
TIA,
Steve Dolan
=====================================================================