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 (October 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 4 Oct 2006 02:01:33 -0700
Reply-To:     "Nordlund, Dan (DSHS)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Surprising retain feature
In-Reply-To:  <1159945834.124060.182280@k70g2000cwa.googlegroups.com>
Content-Type: text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of avi > Sent: Wednesday, October 04, 2006 12:11 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Surprising retain feature > > Hello, > > The problem i had was w. large datasets. I tried to reconstitute it > with a small exemple, but here the retain feature does not work. I'm > quite disturbed (in the exemple, the DPT value for resp_id=2 in the ALL > dataset is supposed to retain its value for previous observation, but > it did not...) > > > ods html file="eee .html" path="C:\" nogtitle style=styles.statdoc ; > > data one; > input resp_id q316 ; > cards; > 1 1 > 2 0 > 3 5 > ; > proc print; > data two; > input resp_id ; Was this intended to only read one variable here?

> cards; > 4 1 > ; > data all; > attrib dpt format=$5.; > set two one; > if Q316=1 then dpt='1111 '; > if Q316=2 then dpt='2222'; > if Q316=3 then dpt='3333'; > proc print; > run; > ods html close; > > > Avi

Avi,

The variable, DPT, in your example is not retained either explicitly or implicitly. It is not listed explicitly in a RETAIN statement. It does not exist in either of the datasets listed in the SET statement and therefore it is not retained implicitly. So, the output is exactly as I would expect. DPT is set to missing at the beginning of each iteration through the data step.

I am too tired to think straight right now, but if someone doesn't beat me to it, I will try and give a short example illustrating implicit RETAINing in the morning after I get some sleep.

Dan

Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204


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