<?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 across obs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551690#M153306</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawdata;
input ID version y;
cards;
1 999 10
1 888 20
1 999 30
2 444 15
3 222 30
3 777 45
4 888 20
;
run;


data want;
set rawdata;
by id;
length want $50;
retain want;
if first.id then want=put(version,8. -l);
else if  find(want,strip(put(version,8.)))=0 then want=catx(',',want,version);
if last.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 17 Apr 2019 12:59:01 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-04-17T12:59:01Z</dc:date>
    <item>
      <title>calculation across obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551675#M153295</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have a data set where a customer can be in multiple rows.&lt;/P&gt;
&lt;P&gt;The task is to create a new data set where each customer appear in one row .&lt;/P&gt;
&lt;P&gt;I want to create a&amp;nbsp; column with distinct values of version for each customer.&lt;/P&gt;
&lt;P&gt;The desired data set will contain 2 fields: ID ,distinct_version&lt;/P&gt;
&lt;P&gt;for customer 1 we will get value :&amp;nbsp;999,888&lt;/P&gt;
&lt;P&gt;for customer 2 we will get value : 444&lt;/P&gt;
&lt;P&gt;for customer 3 we will get value : 222,777&lt;/P&gt;
&lt;P&gt;for customer4 we will get value : 888&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawdata;
input ID version y;
cards;
1 999 10
1 888 20
1 999 30
2 444 15
3 222 30
3 777 45
4 888 20
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 12:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551675#M153295</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-04-17T12:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculation across obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551677#M153296</link>
      <description>&lt;P&gt;You really want text strings like 999,888 with a comma separating the two original numbers?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;What possible use could there be for data in this form?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would it not be better to put 999 into a numeric column (let's name it col1) and then the 888 into another numeric column (let's name it col2)?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 12:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551677#M153296</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-17T12:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: calculation across obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551690#M153306</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawdata;
input ID version y;
cards;
1 999 10
1 888 20
1 999 30
2 444 15
3 222 30
3 777 45
4 888 20
;
run;


data want;
set rawdata;
by id;
length want $50;
retain want;
if first.id then want=put(version,8. -l);
else if  find(want,strip(put(version,8.)))=0 then want=catx(',',want,version);
if last.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 12:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551690#M153306</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-17T12:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: calculation across obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551692#M153307</link>
      <description>&lt;P&gt;Why on earth do you want data structured like that? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 13:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551692#M153307</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-17T13:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: calculation across obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551755#M153335</link>
      <description>&lt;P&gt;One of the reasons you are getting comments about combining values into a single variable relates to "how many" of these values are going to get stuffed into a single variable. And how will they be processed when a later data set comes up with yet another value.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 14:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation-across-obs/m-p/551755#M153335</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-17T14:32:18Z</dc:date>
    </item>
  </channel>
</rss>

