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 (September 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 18 Sep 2002 06:04:06 -0700
Reply-To:     Mohan Menon <mohmenin@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mohan Menon <mohmenin@YAHOO.COM>
Subject:      simple data step question
In-Reply-To:  <>
Content-Type: text/plain; charset=us-ascii

Hi all

I am trying to understand a simple data step. Here is an example

data test; input a b; datalines; 1 3 1 2 2 3 2 5 2 6 4 5 5 6 run;

proc sort data=test; by a b;

data test2; set test; by a b; length p_treat $20;

retain p_treat;

if first.a then p_treat = _treat_;

if b ne . then _treat='Test'; _treat_=_treat; p_treat=_treat_; run;



1 1 2 Test Test Test 2 1 3 Test Test Test 3 2 3 Test Test Test 4 2 5 Test Test Test 5 2 6 Test Test Test 6 4 5 Test Test Test 7 5 6 Test Test Test


I am trying to understand how P_TREAT value in obs 1 gets populated, since P_TREAT values were assigned only at the last data step and is being retained thereafter.

Thanks for your response.


__________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines

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