LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 13 Nov 1997 11:14:15 PST
Reply-To:     TWB2%Rates%FAR@bangate.pge.com
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
Comments: To: vlab@ECON.BERKELEY.EDU

One crude but effective solution would be to set the value back to missing after the OUTPUT statement: DATA TEST1; VAR1=1;OUTPUT;VAR1=.; VAR45=5;OUTPUT;VAR45=.; RUN;

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> Dear SAS-L'ers,

I'm dynamically generating sas datastep statements from a web application. These statements are of the form:

data test1; 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).

Thanks, Harish

*** Here is the test code ****

data test1;

var1=1; * var2 and var3 should be missing in this obs; output;

var2=1; * var1 and var3 should be missing in this obs; output;

var3=1; * var1 and var2 should be missing in this obs; output;

proc print; var var1-var3;

*** Unfortunately, this produces the following output instead: ****

OBS VAR1 VAR2 VAR3

1 1 . . 2 1 1 . 3 1 1 1

=====================================================================


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