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,

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 702 views
  • 1 like
  • 2 in conversation