Hi all SAS Users,
Today I did things with Do...Loop and there is one thing quite ambiguous to me.
In the last demo of lesson 6 of Programming 2, you have the code as below:
I am wondering why do not you set up the statement 'Saving=0;' right after the statement 'Month=0' as the previous demo:
I know the results from the code is right, but why do not we add one more statement for resetting Saving=0, because from my point of view, the Saving of one person will be retained and need to be set up back to zero for calculating for the next person.
Warm regards,
You are right, because the SUM statement will cause Savings to be implicitly RETAINed.
IMO the authors overlooked that.
Astounding is correct. The pg2.savings2 table has a savings column. When the set statement executes, it overwrites the savings value in the program data vector (PDV).
I guess the particulars of the question could be justified if the incoming data is annual, with a variable named AMOUNT representing an a monthly amount to be added for each year.
Then savings is a new variable to be generated representing accrued value of deposits plus monthly interest.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.
Find more tutorials on the SAS Users YouTube channel.