BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi All,

Kindly could anyone suggest how do we get to the output as below using the codesn 1. and 2. :


1.

data invest (drop =i);
do i=1 to 3;
capital+2000;
capital+capital*.1;
end;
run;


Output is: Capital=7282


2.

data invest (drop =year);
do year=1 to 3;
capital+2000;
do month=1 to 3;
Interest=capital*(0.075/12);
end;
end;
run;


Output : Capital=6000, Month=4, Interest=37.5


Kind Regards,
Kriti
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You need to add an explicit OUTPUT statement inside your DO/END loop.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

data step do loop output site:sas.com
ChrisNZ
Tourmaline | Level 20
Unsure what you want to achieve, but rather then an output statement, maybe you want to add a
[pre]put _ALL_;[/pre]
statement before run; ?

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

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
  • 2 replies
  • 1750 views
  • 0 likes
  • 3 in conversation