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.
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
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
Here is the answer.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.