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 (March 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 2 Mar 2000 19:29:59 "GMT"
Reply-To:   "David L. Ward" <dward@SASHELP.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "David L. Ward" <dward@SASHELP.COM>
Subject:   Re: Fundamental Question
Comments:   To: Mo Uddin-M <uddin.m@PG.COM>
Content-Type:   text/plain; charset="us-ascii"

You need to specify which variables you want to keep in data sets a and b. Add keep statements to the data step: >data a (keep=i x y) b (keep=i x z); > set k; > if i in (2, 4, 6) then do; > y=x; > output a; > end; > else if i in (9, 10) then do; > z=x; > output b; > end; >proc print data=a; >proc print data=b; >run;

HTH David Ward SASHelp.com

-----Original Message----- From: Mo Uddin-M <uddin.m@PG.COM> Sent: 3/2/00 7:16:59 PM Subject: Fundamental Question

> Hi Folks, > >I have a very fundamental question. If I run the following code: >data k; > do i=1 to 10; > x=ranuni(100); > output; > end; > >data a b; > set k; > if i in (2, 4, 6) then do; > y=x; > output a; > end; > else if i in (9, 10) then do; > z=x; > output b; > end; >proc print data=a; >proc print data=b; >run; > >I get these two sets for data a & b; > > OBS I X Y Z > > 1 2 0.00887 0.00887 . > 2 4 0.93986 0.93986 . > 3 6 0.92773 0.92773 . > > > OBS I X Y Z > > 1 9 0.97940 . 0.97940 > 2 10 0.65666 . 0.65666 > >My question is why variable Z in data a and Y in data b. >I would appreciate an explanation for this. > >Thanks in advance. > >Mohammad >

_____________________________________________________ Sent by SASHelp.com user DWard SASHelp.com - On-Line SAS Resources Web interface to SAS-L at http://www.sashelp.com/sasl


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