Date: Thu, 13 Nov 1997 11:14:15 PST
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Tim Berryhill 3rd time <TWB2%Rates%FAR@BANGATE.PGE.COM>
Subject: Re: ? dynamically generating data
One crude but effective solution would be to set the value back to missing after
the OUTPUT statement:
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:"Harish Chand" <vlab@ECON.BERKELEY.EDU>
I'm dynamically generating sas datastep statements from a web
application. These statements are of the form:
var1 = 1; output;
var45 = 5; output;
In general, each observation might have a different set
of (non-missing) variables depending on what the user did on the web.
I would like to be able to specify only the non-missing variables and
have the rest set to missing. Unfortunately, sas is behaving as if
there were a retain statement. If the variable is not created, the
previous value is used. This is illustrated in the test code below.
Is there a simple fix (sas option) to this? I would rather not have
to specify what the full set of variables might be ahead of time (as
this set is potentially very large, though with low probability).
*** Here is the test code ****
var1=1; * var2 and var3 should be missing in this obs;
var2=1; * var1 and var3 should be missing in this obs;
var3=1; * var1 and var2 should be missing in this obs;
*** Unfortunately, this produces the following output instead: ****
OBS VAR1 VAR2 VAR3
1 1 . .
2 1 1 .
3 1 1 1