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 1997, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 27 Oct 1997 18:13:18 +0000
Reply-To:     Chris.Murphy@PAREXEL.CO.UK
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Chris Murphy <Chris.Murphy@PAREXEL.CO.UK>
Subject:      Re[2]: Generating trinomial variate?
Content-Type: text/plain; charset=US-ASCII

All,

It seems that if a conditional 'IF' is carried out on a variable that is not common to two datasets that are being merged, then the following peculiar action is seen to take place (observe the missing 'value' where patnum = 2 on the 'test' dataset!!).

However if the dataset 'test' did not contain the conditional loop and was then set in a new data step with the conditional do loop applied in the new step then then 'value' would not be missing for the observation where patnum = 2; it would be 1 as expected.

Can anyboy explain. I looked at this using v609 on a VAX platfrom. I haven't had time to experiment further but I would welcome a reasonable explanation.

*******************code**************************************

data one; patnum = 1; outv = 'a'; output; patnum = 2; outv ='a'; output; patnum = 3; outv = 'b'; output; run;

proc sort data = one; by outv; run;

title1 "dataset one"; proc print; run;

data two; outv = 'a'; value = 1; output; outv = 'b'; value = 2; output; run;

title1 "dataset two"; proc sort data = two; by outv; run;

proc print; run;

data test; merge one two; by outv; if patnum = 1 then do; outv = ' '; value = .; end; run;

title1 "dataset test"; proc print; run;

**********output *******************

dataset one

OBS PATNUM OUTV

1 1 a 2 2 a 3 3 b

dataset two

OBS OUTV VALUE

1 a 1 2 b 2

dataset test

OBS PATNUM OUTV VALUE

1 1 . 2 2 a . 3 3 b 2

Regards

Chris.


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