<?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 How do I create a Concentration curve and associated GINI coefficient? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/475643#M122318</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been tasked with creating a Concentration curve based on some socioeconomic data and health data, but it's proving to be quite tricky to even find documentation on how to set things up. I've managed to find this paper about how to do it in STATA &lt;A href="http://repec.sowi.unibe.ch/files/wp15/jann-2016-lorenz.pdf" target="_self"&gt;(http://repec.sowi.unibe.ch/files/wp15/jann-2016-lorenz.pdf)&amp;nbsp;&lt;/A&gt;, but nothing for SAS. Normally I would include a sample dataset, but to be honest I can't even figure out how the data needs to be laid out. I am pretty sure it can be done, but I am at a loss as to where to begin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jul 2018 14:24:32 GMT</pubDate>
    <dc:creator>righcoastmike</dc:creator>
    <dc:date>2018-07-05T14:24:32Z</dc:date>
    <item>
      <title>How do I create a Concentration curve and associated GINI coefficient?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/475643#M122318</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been tasked with creating a Concentration curve based on some socioeconomic data and health data, but it's proving to be quite tricky to even find documentation on how to set things up. I've managed to find this paper about how to do it in STATA &lt;A href="http://repec.sowi.unibe.ch/files/wp15/jann-2016-lorenz.pdf" target="_self"&gt;(http://repec.sowi.unibe.ch/files/wp15/jann-2016-lorenz.pdf)&amp;nbsp;&lt;/A&gt;, but nothing for SAS. Normally I would include a sample dataset, but to be honest I can't even figure out how the data needs to be laid out. I am pretty sure it can be done, but I am at a loss as to where to begin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 14:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/475643#M122318</guid>
      <dc:creator>righcoastmike</dc:creator>
      <dc:date>2018-07-05T14:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a Concentration curve and associated GINI coefficient?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476316#M122555</link>
      <description>&lt;P&gt;This link &lt;A href="https://groups.google.com/forum/#!topic/comp.soft-sys.sas/UaXlg153QpM" target="_self"&gt;https://groups.google.com/forum/#!topic/comp.soft-sys.sas/UaXlg153QpM&lt;/A&gt; is a Pace University revision&amp;nbsp; of a program I wrote at Univ of Penn about 25&amp;nbsp; years ago.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 20:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476316#M122555</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-08T20:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a Concentration curve and associated GINI coefficient?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476326#M122564</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/154458"&gt;@righcoastmike&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please find below a program I wrote at home about&amp;nbsp;one hour ago. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input population income;
cards;
24113 29393
 6554 33011
19225 52976
19909 59591
22448 64511
24536 67992
;

data want;
output;
do until(eof1);
  set have end=eof1;
  total_pop+population;
  total_inc+population*income;
end;
do until(eof2);
  set have end=eof2;
  share_inc=population*income/total_inc;
  cum_pop+population/total_pop;
  cum_inc+share_inc;
  g+(cum_pop+max(lag(cum_pop),0))*share_inc;
  output;
end;
gini=g-1;
call symput('gini', put(gini, 5.3)); /* change format 5.3 to 11.9 for comparison */
format cum: percent9.2;
label cum_pop='Cumulative shares of population'
      cum_inc='Cumulative shares of income';
keep cum:;
stop;
run;

proc sgplot data=want;
title 'Lorenz curve';
series x=cum_pop y=cum_inc / legendlabel='Lorenz curve';
series x=cum_inc y=cum_inc / legendlabel='Perfect equality line';
xaxis offsetmin=0 offsetmax=0;
yaxis offsetmin=0 offsetmax=0;
inset "Gini coeff.: &amp;amp;gini" / border position=left textattrs=(Size=12);
refline 0.2 to 1 by 0.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It replicates the results of the&amp;nbsp;"complete handout" (section "2. Age inequalities", Table 3, Graph 3) linked in section "External links" of the &lt;A href="https://en.wikipedia.org/wiki/Lorenz_curve" target="_blank"&gt;Wikipedia article "Lorenz curve"&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Graph:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lorenz_curve.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21643i8AB9C0CDBE02906B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Lorenz_curve.png" alt="Lorenz_curve.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 21:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476326#M122564</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-08T21:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a Concentration curve and associated GINI coefficient?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476449#M122620</link>
      <description>&lt;P&gt;Thanks so much Freelance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a huge help. It will take me a little bit to go through and figure out what you did, but that will be a good exercise all on its own. It's becoming clear to me that the "DO loop" is something I'm going to have to get more comfortable with.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476449#M122620</guid>
      <dc:creator>righcoastmike</dc:creator>
      <dc:date>2018-07-09T13:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a Concentration curve and associated GINI coefficient?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476451#M122622</link>
      <description>Thanks so much for this mkeitz, I'll take a closer look at this and hopefully get a better sense of how things need to get set up.&lt;BR /&gt;&lt;BR /&gt;Rightcoast.</description>
      <pubDate>Mon, 09 Jul 2018 13:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-Concentration-curve-and-associated-GINI/m-p/476451#M122622</guid>
      <dc:creator>righcoastmike</dc:creator>
      <dc:date>2018-07-09T13:48:32Z</dc:date>
    </item>
  </channel>
</rss>

