Help using Base SAS procedures

DO Block in SAS

Reply
N/A
Posts: 0

DO Block in SAS

Hello ,

I run the code -

data revenue;
set sales;
if Laptopmodel="AT3600" then do;
if warranty=1 then revenue=units_sold*(1199.99+39);
if warranty=0 then revenue=units_sold*1199.99;
proc print data = revenue;
run;

the log -

89 data revenue;
90 set sales;
91 if Laptopmodel="AT3600" then do;
92 if warranty=1 then revenue=units_sold*(1199.99+39);
93 if warranty=0 then revenue=units_sold*1199.99;

93 if warranty=0 then revenue=units_sold*1199.99;
-
117
ERROR 117-185: There was 1 unclosed DO block.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.REVENUE may be incomplete. When this step was stopped there were 0
observations and 8 variables.


Kindly suggets.

regards ,

markc
SAS Super FREQ
Posts: 8,743

Re: DO Block in SAS

Hi:
The documentation on the IF statement and the DO statement has some very good examples:
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000202239.htm
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000201951.htm

The ERROR message is quite clear on what is wrong:
ERROR 117-185: There was 1 unclosed DO block.


A DO statement or DO block is closed with an END statement.

I also suggest that you read about step boundaries and DATA step processing to find out more about the RUN statement (to end or stop the DATA step from executing).
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001331122.htm

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 271 views
  • 0 likes
  • 2 in conversation