BookmarkSubscribeRSS Feed
KBA17
Calcite | Level 5

I am trying to eventually get a sum of loanapproved per Branch (column) 1-5 (values) using array - Thank you

data dloans3;
	set dloans2;
	array Branch (5) Branch1 Branch2 Branch3 Branch4 Branch5;
	do i = 1 to 5;
	Branch1(i)=Branch1(i) + 1;
	end;
	drop i;
RUN;
2 REPLIES 2
ballardw
Super User

Example input data.

Example expected result for that example data.

There are enough different ways to "sum" that we need to know which one you mean.

PaigeMiller
Diamond | Level 26

I don't know what you mean by sums here ... and I don't understand why you chose to write "SUM(s)" which must mean something to you but doesn't mean anything to us ... what you show in your code, adding one to a variable, is generally not what I think of as finding sums. We need to see sample of your data, and the desired output.

 

I am trying to eventually get a sum of loanapproved per Branch (column) 1-5 (values) using array

 

Also ... why does it have to be an array? A common mistake for beginners is to specify a certain technique should be used, when in fact it would simply be better to state the problem without specifying the method of solution.

--
Paige Miller
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 1176 views
  • 0 likes
  • 3 in conversation