| Date: | Thu, 31 May 2007 09:39:00 -0400 |
| Reply-To: | Matt Pettis <matt.pettis@THOMSON.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Matt Pettis <matt.pettis@THOMSON.COM> |
| Subject: | Re: Please give the explanation of this..... |
|---|
The data step writes data to the dataset named on the 'data' line when
either a) it encounters and executes an 'output' statement, or b) it hits
the bottom of the datastep (which is the 'run' statement here).
both 'do' loops spin around inside of the datastep, incrementing x,
WITHOUT encountering an 'output' statement. When the code finally hits
the 'run' statement after executing 'x + 1' 60 times (or so -- i may have
a 1-off error), it outputs that value of x. since there is no 'set'
or 'infile' statement to make this step start executing for a second time,
SAS stops.
That's how you get only one observation. Make sense?
Matt
On Thu, 31 May 2007 04:34:31 -0700, Naren <narendra.palmure@GMAIL.COM>
wrote:
>data work.sales;
>do year = 1 to 5;
>do month = 1 to 12;
>x + 1;
>end;
>end;
>run;
>Which one of the following represents how many observations are
>written to the WORK.SALES data set?
>A. 0
>B. 1
>C. 5
>D. 60
>Answer: B
>
>Please give me the explanation of this problem...
|