<?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 Diff in Arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335228#M75850</link>
    <description>&lt;P&gt;hi how to find diiference for below data using arrays&lt;/P&gt;&lt;P&gt;need diff between qtr1-qtr1n.. so on..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs id qtr1 qtr2 qtr3 qtr4 Qtr1n Qtr2n Qtr3n Qtr4n i 1 2 3&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;62.5&lt;/TD&gt;&lt;TD&gt;125.0&lt;/TD&gt;&lt;TD&gt;187.5&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;104&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;120&lt;/TD&gt;&lt;TD&gt;180&lt;/TD&gt;&lt;TD&gt;75.0&lt;/TD&gt;&lt;TD&gt;125.0&lt;/TD&gt;&lt;TD&gt;150.0&lt;/TD&gt;&lt;TD&gt;225&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;106&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;130&lt;/TD&gt;&lt;TD&gt;160&lt;/TD&gt;&lt;TD&gt;220&lt;/TD&gt;&lt;TD&gt;100.0&lt;/TD&gt;&lt;TD&gt;162.5&lt;/TD&gt;&lt;TD&gt;200.0&lt;/TD&gt;&lt;TD&gt;275&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Thu, 23 Feb 2017 10:28:50 GMT</pubDate>
    <dc:creator>Ravikumarpa4</dc:creator>
    <dc:date>2017-02-23T10:28:50Z</dc:date>
    <item>
      <title>Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335228#M75850</link>
      <description>&lt;P&gt;hi how to find diiference for below data using arrays&lt;/P&gt;&lt;P&gt;need diff between qtr1-qtr1n.. so on..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs id qtr1 qtr2 qtr3 qtr4 Qtr1n Qtr2n Qtr3n Qtr4n i 1 2 3&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;62.5&lt;/TD&gt;&lt;TD&gt;125.0&lt;/TD&gt;&lt;TD&gt;187.5&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;104&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;120&lt;/TD&gt;&lt;TD&gt;180&lt;/TD&gt;&lt;TD&gt;75.0&lt;/TD&gt;&lt;TD&gt;125.0&lt;/TD&gt;&lt;TD&gt;150.0&lt;/TD&gt;&lt;TD&gt;225&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;106&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;130&lt;/TD&gt;&lt;TD&gt;160&lt;/TD&gt;&lt;TD&gt;220&lt;/TD&gt;&lt;TD&gt;100.0&lt;/TD&gt;&lt;TD&gt;162.5&lt;/TD&gt;&lt;TD&gt;200.0&lt;/TD&gt;&lt;TD&gt;275&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 23 Feb 2017 10:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335228#M75850</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2017-02-23T10:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335230#M75851</link>
      <description>&lt;P&gt;How do you want the differences presentes? In seperate columns? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 10:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335230#M75851</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-02-23T10:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335231#M75852</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Post test data in the form of a datastep, we are not here for data entry!&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array qtr{4};
  array qtr2{4} qtr1n qtr2n qtr3n qtr4n;
  array res{4};
  do i=1 to 4;
    res{i}=qtr2{i}-qtr{i};
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Why have you called array elements qtrXn, that just makes your programming harder, put the number at the end.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 10:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335231#M75852</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-23T10:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335232#M75853</link>
      <description>&lt;P&gt;yes same as qtr1m qtr2m qtr3m qtr4m&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 10:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335232#M75853</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2017-02-23T10:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335245#M75856</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is my original data set;&lt;/P&gt;&lt;P&gt;first&amp;nbsp;I need&amp;nbsp;increasing qtr value&amp;nbsp;to 25% later i wanted difference between both by using arrays. kould you help on this&lt;/P&gt;&lt;P&gt;id qtr1 qtr2 qtr3 qtr4;&lt;/P&gt;&lt;P&gt;102 50 100 150 200&lt;/P&gt;&lt;P&gt;104 60 100 120 180&lt;/P&gt;&lt;P&gt;106 80 130 160 220&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 11:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335245#M75856</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2017-02-23T11:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335248#M75857</link>
      <description>&lt;P&gt;For those who have a hard time grasping the concept, this is how you post data in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id qtr1 qtr2 qtr3 qtr4;
cards;
102 50 100 150 200
104 60 100 120 180
106 80 130 160 220
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now all possible helpers only need a copy/paste and "run" to recreate your dataset. Be courteous to those who shall help you.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 11:35:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335248#M75857</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-23T11:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335250#M75859</link>
      <description>&lt;P&gt;Something like (again, not typing in):&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array qtr{4};
  array qtr2{4};
  array res{4};
  do i=1 to 4;
    qtr2{i}=1.25 * qtr{1};
    res{i}=qtr2{i}-qtr{i};
  end;
run;&lt;/PRE&gt;
&lt;P&gt;However this doesn't make much sense as diff will always be 25% so why the need for the second set of variables at all, just do:&lt;/P&gt;
&lt;P&gt;res{i}=(qtr{i} / 100) * 25;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 11:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335250#M75859</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-23T11:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Diff in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335251#M75860</link>
      <description>##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##&lt;BR /&gt;Hi&lt;BR /&gt;That's I've done it already. Now I'm wanted increase values by 25% and&lt;BR /&gt;later I wanted find difference between both by using Arrays&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ravi</description>
      <pubDate>Thu, 23 Feb 2017 11:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diff-in-Arrays/m-p/335251#M75860</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2017-02-23T11:38:19Z</dc:date>
    </item>
  </channel>
</rss>

