Help using Base SAS procedures

DO Loop

Reply
N/A
Posts: 0

DO Loop

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
Super Contributor
Super Contributor
Posts: 3,174

Re: DO Loop

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
PROC Star
Posts: 1,630

Re: DO Loop

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; ?
Ask a Question
Discussion stats
  • 2 replies
  • 307 views
  • 0 likes
  • 3 in conversation