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-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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