<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: calculation of some variables Please help in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160014#M2954</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still hard to catch you. Does it make some sense ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;


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
&amp;nbsp; select country,year,sum(ta/tma) as _5cr 
&amp;nbsp;&amp;nbsp; from top5
&amp;nbsp;&amp;nbsp;&amp;nbsp; group by country,year ;

 create table two as
&amp;nbsp;&amp;nbsp; select year,sum(ms**2) as hhi
&amp;nbsp;&amp;nbsp;&amp;nbsp; from have
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by year;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Dec 2014 11:36:58 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-12-22T11:36:58Z</dc:date>
    <item>
      <title>calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160011#M2951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;Hy friends&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;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&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;a) 5CR= share of 5 largest bank asset (useing TA in the file)/ Total Asset in the Market (TMA)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;i need to calculate the sum of 5 largest banks in each country in each year ????? please provide some codes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;2) HHI= Sigma (MS) sequre&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;i can calculate this by using command like&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;data temp1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;MS2=MS*MS;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;calculation of sum...&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;proc Means Sum;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;var MS2;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;by Year;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;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&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f8f8f8;"&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 09:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160011#M2951</guid>
      <dc:creator>raqthesolid</dc:creator>
      <dc:date>2014-12-22T09:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160012#M2952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;


proc import datafile='c:\temp\Datafile.xls' out=have dbms=excel replace;run;


proc sql;
 create table temp as
&amp;nbsp; select *, ta/tma as _5cr ,sum(ms**2) as hhi
&amp;nbsp;&amp;nbsp; from have
&amp;nbsp;&amp;nbsp;&amp;nbsp; group by year
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 10:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160012#M2952</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-22T10:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160013#M2953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i appreciate your prompt response but it is different from what i want.&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt; create table temp as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select *, ta/tma as _5cr ,sum(ms**2) as hhi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by country,year,_5cr desc;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) need to sort the data by country and Bank&lt;/P&gt;&lt;P&gt;thank sum the five largest bank in each year&lt;/P&gt;&lt;P&gt;thank sum of five largest bank/ TMA (same year)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for HHI&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;square of Market share of each firm&lt;/P&gt;&lt;P&gt;then add the firms in each year like for 1999 one value which i call as Sumation or Sigma (MS) square&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I shall be very thankful if you could do this for me.&lt;/P&gt;&lt;P&gt;thanks for your valuable response &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 10:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160013#M2953</guid>
      <dc:creator>raqthesolid</dc:creator>
      <dc:date>2014-12-22T10:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160014#M2954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still hard to catch you. Does it make some sense ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;


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
&amp;nbsp; select country,year,sum(ta/tma) as _5cr 
&amp;nbsp;&amp;nbsp; from top5
&amp;nbsp;&amp;nbsp;&amp;nbsp; group by country,year ;

 create table two as
&amp;nbsp;&amp;nbsp; select year,sum(ms**2) as hhi
&amp;nbsp;&amp;nbsp;&amp;nbsp; from have
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by year;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 11:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160014#M2954</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-22T11:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160015#M2955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.. &lt;/P&gt;&lt;P&gt;Please write something for this two also recommend me some material to learn sas i am beginner..&lt;/P&gt;&lt;P&gt;Thanks a lot &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 14:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160015#M2955</guid>
      <dc:creator>raqthesolid</dc:creator>
      <dc:date>2014-12-22T14:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160016#M2956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OH. That is easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table two as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select &lt;STRONG&gt;country,year&lt;/STRONG&gt;,sum(ms**2) as hhi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt; group by country,year ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About your question, go and ask&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="j-avatar jiveTT-hover-user" data-avatarid="1058" data-externalid="" data-presence="null" data-userid="63295" data-username="Cynthia%40sas" href="https://communities.sas.com/people/Cynthia@sas" style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0e66ba; background-color: #ffffff;"&gt;&lt;IMG alt="Cynthia@sas" border="0" class="jive-avatar jiveImage" data-avatarid="1058" data-height="22" data-username="Cynthia%40sas" height="22" src="https://communities.sas.com/people/Cynthia%40sas/avatar/22.png?a=1058" style="margin: 2px 6px 0 0; border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;" width="22" /&gt;&lt;/A&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link active_link" data-avatarid="1058" data-externalid="" data-presence="null" data-userid="63295" data-username="Cynthia%40sas" href="https://communities.sas.com/people/Cynthia@sas" id="jive-6329534636911783804186" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0e66ba;"&gt;Cynthia@sas&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;She is an excellent SAS programming trainer . But if you want become an seasoned programmer, stick with this community and work with us.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Good Luck.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Xia Keshan&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Ksharp&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 5px 0 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 14:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160016#M2956</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-22T14:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: calculation of some variables Please help</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160017#M2957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for your help &lt;/P&gt;&lt;P&gt;you wish you good luck in life..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 15:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calculation-of-some-variables-Please-help/m-p/160017#M2957</guid>
      <dc:creator>raqthesolid</dc:creator>
      <dc:date>2014-12-22T15:19:52Z</dc:date>
    </item>
  </channel>
</rss>

