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 (April 2001, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Apr 2001 11:29:53 -0700
Reply-To:     "Huang, Ya" <ya.huang@AGOURON.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <ya.huang@AGOURON.COM>
Subject:      A fundamental data step questions
Content-Type: multipart/alternative;

Hi there,

This question is for those data step gurus.

I always feel that data step programming is the toughest part of SAS programming. Most time I just give up and turn to those PROCs, especially PROC SQL. I feel that it is now the time for me to take a close look at some fundamental (maybe I should say advanced?) data step techniques, just for the sake of writing more efficient program.

Following is my sample code and the logs:

1 data xx; 2 do i=1 to 5; 3 output; 4 end; 5

NOTE: The data set WORK.XX has 5 observations and 1 variables. NOTE: DATA statement used: real time 1.30 seconds cpu time 0.04 seconds

6 data _null_; 7 set xx; 8 put _all_; 9 set xx; 10 put _all_; 11 stop; 12 run;

i=1 _ERROR_=0 _N_=1 i=1 _ERROR_=0 _N_=1 NOTE: There were 1 observations read from the dataset WORK.XX. NOTE: There were 1 observations read from the dataset WORK.XX. NOTE: DATA statement used: real time 0.02 seconds cpu time 0.02 seconds

13 14 data _null_; 15 do k=1 to 2; 16 set xx; 17 put _all_; 18 end; 19 stop; 20 run;

k=1 i=1 _ERROR_=0 _N_=1 k=2 i=2 _ERROR_=0 _N_=1 NOTE: There were 2 observations read from the dataset WORK.XX. NOTE: DATA statement used: real time 0.02 seconds cpu time 0.02 seconds

Now my question is that why the two set statement in the first data step read the same record from xx, but if I put it in a do loop as it in the second data step, then it read different record? For me they look same, do loop is just a compact writing.

Thanks for explanation.

Ya Huang


[text/html]


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