| Date: | Wed, 3 Nov 2010 16:50:17 -0400 |
| Reply-To: | bbser2009 <bbser2009@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | bbser2009 <bbser2009@GMAIL.COM> |
| Subject: | Re: retain statement |
|
| In-Reply-To: | <201011031941.oA3B2O4r007268@willow.cc.uga.edu> |
| Content-Type: | text/plain; charset="us-ascii" |
Chang,
How to examine x? I tried x?; x=;
Neither worked.
Thanks.
Max
-----Original Message-----
From: Chang Chung [mailto:chang_y_chung@HOTMAIL.COM]
Sent: November-03-10 3:42 PM
To: SAS-L@LISTSERV.UGA.EDU; Bbser 2009
Subject: Re: retain statement
On Wed, 3 Nov 2010 12:31:56 -0400, bbser2009 <bbser2009@GMAIL.COM> wrote:
>Suppose we a code like this:
>...
>retain x=1000; *first occurrence of x;
>...
>
>Just after the compilation and before the execution,
>what's the value of x in the programme data vector?
...
Hi, Max,
I am not sure, but retain is a declarative statement, taking effect at
compile time. Thus, even though I am not sure when exactly the retained
variables are initialized with the given initial values, but I am quite
sure that when the execution starts, they should be initialized already.
The latter can be easily shown by running the data step debugger on a data
step like below:
data one/debug;
stop;
set sashelp.class;
retain x 1000;
run;
Examine x as soon as the debugger starts. You will find that x is already
assigned 1000.
Cheers,
Chang
|