BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
1 REPLY 1
Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 3527 views
  • 0 likes
  • 2 in conversation