<?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: Calculating an Index in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377470#M276725</link>
    <description>&lt;P&gt;Show an example have dataset with, say, three actual variables, and also a want dataset based on the example have dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 17:20:52 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-07-19T17:20:52Z</dc:date>
    <item>
      <title>Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377449#M276724</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate an Index based on the Herfindahl-Index formula. The problem is that the names of my columns do not have the same prefix and I have many variables (approx. 260) therefore I prefer not to type every variable manually.&lt;/P&gt;&lt;P&gt;The table looks like this:&lt;/P&gt;&lt;P&gt;Year&amp;nbsp;&amp;nbsp; &amp;nbsp;ReporterISO3&amp;nbsp;&amp;nbsp; &amp;nbsp;ReporterName&amp;nbsp;&amp;nbsp; &amp;nbsp;ABW in 1000 ....&amp;nbsp;&amp;nbsp;&amp;nbsp; ZWE in 1000&amp;nbsp;&amp;nbsp; Sum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HI (goal)&lt;BR /&gt;2005&amp;nbsp;&amp;nbsp; &amp;nbsp;QAT&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qatar&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 200 &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&amp;nbsp;&amp;nbsp;&amp;nbsp; 100 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 200+....+100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;2006&amp;nbsp;&amp;nbsp; &amp;nbsp;QAT&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qatar&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0+....+10&lt;BR /&gt;2005&amp;nbsp;&amp;nbsp; &amp;nbsp;SEN&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Senegal&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&amp;nbsp;&amp;nbsp;&amp;nbsp; 200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000+....+200&lt;BR /&gt;2006&amp;nbsp;&amp;nbsp; &amp;nbsp;SEN&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Senegal&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2000&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2000+....+50&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The .... stands for the other approx. 258 columns.&lt;/P&gt;&lt;P&gt;My goal is to calcualte:&lt;/P&gt;&lt;P&gt;HI=('ABW in 1000'n/Sum)^2+...+('ZWE in 1000'n/Sum)^2&lt;/P&gt;&lt;P&gt;So that I will have one value for year. I already calculated the sum with an array function. The column header have spaces in the name thats why I used ''n.&lt;/P&gt;&lt;P&gt;Thank you very much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377449#M276724</guid>
      <dc:creator>aguilar_john</dc:creator>
      <dc:date>2017-07-19T16:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377470#M276725</link>
      <description>&lt;P&gt;Show an example have dataset with, say, three actual variables, and also a want dataset based on the example have dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377470#M276725</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-19T17:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377477#M276726</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to upload a test dataset with the SAS table but that did not quite work. Attached you will find an Excel-sheet with 3 of the 260 columns and the corresponding formulas.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377477#M276726</guid>
      <dc:creator>aguilar_john</dc:creator>
      <dc:date>2017-07-19T17:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377488#M276727</link>
      <description>&lt;P&gt;Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377488#M276727</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-07-19T17:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377496#M276728</link>
      <description>Thank you very much for the advice.&lt;BR /&gt;I downloaded the file but since I dont have the SAS UE but only SAS EG I do not understand what to do...&lt;BR /&gt;Is there another way how I can provide my sample dataset?&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377496#M276728</guid>
      <dc:creator>aguilar_john</dc:creator>
      <dc:date>2017-07-19T18:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377500#M276729</link>
      <description>&lt;P&gt;Here is a way to do what you want. While you said you already calculated the sum variable, I recalculated it below thus it could be removed from the code and replaced with your already calulated sum:&lt;/P&gt;
&lt;PRE&gt;options validvarname=any;
data have;
  informat ReporterName $30.;
  input year reporterISO3 $ ReporterName &amp;amp; key_geo $
   'ABW in 1000 USD'n
   'AFG in 1000 USD Summe'n
   'ZWE in 1000 USD Summen'n;
  cards;
2004 ITA Italy  ITA2004 13276.394 24696.036 14241.438
2005 ITA Italy  ITA2005 13081.68 26697.422 10059.875
2006 ITA Italy  ITA2006 13950.723 16204.154 8806.267
;
data want;
  set have;
  array all(*) 'ABW in 1000 USD'n--'ZWE in 1000 USD Summen'n;
  array work(99999) _temporary_;
  sum=sum(of all(*));
  do i=1 to dim(all);
    work(i)=(all(i)/sum)**2;
  end;
  hi=sum(of work(*));
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377500#M276729</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-19T18:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating an Index</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377505#M276730</link>
      <description>WOW Thank you very much!!!</description>
      <pubDate>Wed, 19 Jul 2017 18:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-an-Index/m-p/377505#M276730</guid>
      <dc:creator>aguilar_john</dc:creator>
      <dc:date>2017-07-19T18:31:07Z</dc:date>
    </item>
  </channel>
</rss>

