Date: Fri, 9 Nov 2007 15:24:32 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: appending SAS dataset with an addition of new column
On Fri, 9 Nov 2007 01:45:47 -0000, Sri <subhadrasri@GMAIL.COM> wrote:
>Hi All,
>I have been trying this for the past couple of days and decided to
>take advise from those who have already been there and did that!
>I have a shell script that runs on daily basis and executes 10
>different SAS programs during the process. When SAS datasets are
>created, they are appended every day to the previous day's datasets
>and the data is preserved for 180 days. Now, i have to add a new
>variable to one of the datasets. But when i append to the previous
>dataset, it gives me a warning saying that the variable is not present
>in the base dataset, therefore it is dropped! Other than using SET
>statement (i don't want to use SET because everyday i have to append
>the data to the previous days data, by using set i will be using lot
>of memory resources), is there a way for me to achevie it? For time-
>being, i changed the new dataset name, but i bet it's a crude way and
>there are many better ways out there to aheive it.
>Please respond to my email at your earliest possible convenince.
>
>Thank you
PROC SQL will permit the addition of new columns to an existing table. To
illustrate:
data xy;
x =1;
y =2;
run;
proc sql;
alter table xy add z numeric;
quit;
proc print data=xy; run;
Result:
Obs x y z
1 1 2 .
However, it's important to understand that behind the scenes the entire
table has to be transcribed, which might take a lot of time if the table is
large.
|