SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

calculation of some variables Please help

Accepted Solution Solved
Reply
Contributor
Posts: 68
Accepted Solution

calculation of some variables Please help

Hy friends

i have uploaded a file with this post kindly check this i need to calculate few variables please help me i have to submit my class assignment and i am not coming up with these thanks a lot

a) 5CR= share of 5 largest bank asset (useing TA in the file)/ Total Asset in the Market (TMA)

i need to calculate the sum of 5 largest banks in each country in each year ????? please provide some codes

2) HHI= Sigma (MS) sequre

i can calculate this by using command like

data temp1;

MS2=MS*MS;

run;

calculation of sum...

proc Means Sum;

var MS2;

by Year;

run;

this give me output file but i do not know how can i get this is sas data file like i have uploaded here to include this in my final data set. kindly provide me any procedure to export this into excel or other file so that i can run some test on this ... i will be very thankful to you for this kindness

Regards


Accepted Solutions
Solution
‎12-22-2014 09:19 AM
Super User
Posts: 10,046

Re: calculation of some variables Please help

Posted in reply to raqthesolid

OH. That is easy.

proc sql;

create table two as

   select country,year,sum(ms**2) as hhi

    from have

    group by country,year ;

quit;

About your question, go and ask

Cynthia@sasCynthia@sas

She is an excellent SAS programming trainer . But if you want become an seasoned programmer, stick with this community and work with us.


Good Luck.

Xia Keshan

Ksharp


View solution in original post


All Replies
Super User
Posts: 10,046

Re: calculation of some variables Please help

Posted in reply to raqthesolid

How about :



proc import datafile='c:\temp\Datafile.xls' out=have dbms=excel replace;run;


proc sql;
 create table temp as
  select *, ta/tma as _5cr ,sum(ms**2) as hhi
   from have
    group by year
     order by country,year,_5cr desc;
quit;

data want;
 set temp;
 by country year ;
 if first.year then n=0;
 n+1;
 if n lt 6;
 drop n;
run;


Xia Keshan

Contributor
Posts: 68

Re: calculation of some variables Please help

i appreciate your prompt response but it is different from what i want.

proc sql;

create table temp as

  select *, ta/tma as _5cr ,sum(ms**2) as hhi

   from have

    group by year

     order by country,year,_5cr desc;

quit;

1) need to sort the data by country and Bank

thank sum the five largest bank in each year

thank sum of five largest bank/ TMA (same year)

for HHI

1)

square of Market share of each firm

then add the firms in each year like for 1999 one value which i call as Sumation or Sigma (MS) square

I shall be very thankful if you could do this for me.

thanks for your valuable response

Super User
Posts: 10,046

Re: calculation of some variables Please help

Posted in reply to raqthesolid

Still hard to catch you. Does it make some sense ?



proc import datafile='c:\temp\Datafile.xls' out=have dbms=excel replace;run;

proc sort data=have;by country year descending ta ;run;
data top5;
 set have;
 by country year ;
 if first.year then n=0;
 n+1;
 if n lt 6;
 drop n;
run;

proc sql;
 create table one as
  select country,year,sum(ta/tma) as _5cr 
   from top5
    group by country,year ;

 create table two as
   select year,sum(ms**2) as hhi
    from have
      group by year;
quit;

Xia Keshan

Contributor
Posts: 68

Re: calculation of some variables Please help

Thanks its really a great help from your side. the 1st one is exactly the same as i wanted but second is on the basis of country , actually i want it in the same way as you calculated first like country than in each country specific value for each year..

Please write something for this two also recommend me some material to learn sas i am beginner..

Thanks a lot

Solution
‎12-22-2014 09:19 AM
Super User
Posts: 10,046

Re: calculation of some variables Please help

Posted in reply to raqthesolid

OH. That is easy.

proc sql;

create table two as

   select country,year,sum(ms**2) as hhi

    from have

    group by country,year ;

quit;

About your question, go and ask

Cynthia@sasCynthia@sas

She is an excellent SAS programming trainer . But if you want become an seasoned programmer, stick with this community and work with us.


Good Luck.

Xia Keshan

Ksharp


Contributor
Posts: 68

Re: calculation of some variables Please help

Thanks a lot for your help

you wish you good luck in life..

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 485 views
  • 6 likes
  • 2 in conversation