BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kngu022
Obsidian | Level 7

I have this code. I guess the stored value for Year will be 2004. However, when I put this code in SAS. the result appears stored value for YEAR as 2005. Could anyone help me to understand this code, please?

DATA work.invest;
	VALUE = 2000;
	DO year = 1990 TO 2004;
		Capital + 5000;
		Capital + (Capital*0.10);
	END;
RUN;
1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @kngu022 

 

After the 15th execution of the DO loop (corresponding to year=2004), the value of Year is incremented to 2005. Because 2005 exceeds the stop value of the iterative DO statement, the DO loop stops executing, and processing continues to the next DATA step statement.

Best,

 

 

View solution in original post

1 REPLY 1
ed_sas_member
Meteorite | Level 14

Hi @kngu022 

 

After the 15th execution of the DO loop (corresponding to year=2004), the value of Year is incremented to 2005. Because 2005 exceeds the stop value of the iterative DO statement, the DO loop stops executing, and processing continues to the next DATA step statement.

Best,

 

 

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

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 632 views
  • 1 like
  • 2 in conversation