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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 1320 views
  • 0 likes
  • 3 in conversation