## average rate growth of sales for each branch by year wise.

Frequent Contributor
Posts: 84

# average rate growth of sales for each branch by year wise.

I have data like this

Branch year sales

india 2009 1mn

india 2010 1.2mn

nepal 2008 0.5mn

nepal 2009 1mn

...;

like that i have many countries

i want , average rate of growth of sales for each branch by year wise. Please suggest some logics.

Posts: 4,736

## Re: average rate growth of sales for each branch by year wise.

Hi Kumar

In my understanding this forum provides quality support to people who get stuck with a problem and need help. What this forum is not about is doing the work for you.

I suggest you first give it a go and then come back if you can't solve the problem by yourself. You then give us sample data (a data step generating this data so we don't have to do the work), and explanation what you have and what you want, and a sample of how the "what you want" looks like.

If you already developed some code (may be not working) then post this code as well. This will help us to better understand where you are at and where you might need some help.

Thanks

Patrick

Posts: 5,526

## Re: average rate growth of sales for each branch by year wise.

What should the output look like for input

Branch year salesMn

india 2009 1

india 2010 1.2

india 2011 1.1

nepal 2008 0.5

nepal 2009 1

PG

PG
Frequent Contributor
Posts: 89

## Re: average rate growth of sales for each branch by year wise.

First convert into numeric variable sales using input function and use compress function to replace alphabets from value and then use proc sql.

Here is the code.

Correct me if I am wrong

data ds1;

infile cards;

input

Branch \$ year sales \$;

cards;

india 2009 1mn

india 2009 2mn

india 2010 1.2mn

nepal 2008 0.5mn

nepal 2009 1mn

;

data ds2;

set ds1;

sales1=compress(sales,'','a');

numeric=input(sales1,8.);

drop sales;

run;

proc sql;

create table demo as

select Branch,year,avg(numeric)as sales from ds2 group by Branch,year ;

quit;

Discussion stats
• 3 replies
• 246 views
• 0 likes
• 4 in conversation