<?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: Sparsing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20794#M3276</link>
    <description>Use a DATA step to read-up the data, then use the LAG function and also use INTCK to compute delta/difference between consecutive observations.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Thu, 21 Oct 2010 21:24:02 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-10-21T21:24:02Z</dc:date>
    <item>
      <title>Sparsing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20793#M3275</link>
      <description>Code                       Date&lt;BR /&gt;
A1                          4/30/2010&lt;BR /&gt;
B1                          5/16/2010&lt;BR /&gt;
C1                          5/30/2010&lt;BR /&gt;
D1                          6/16/2010&lt;BR /&gt;
E1                          4/30/2010&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
How to display only those codes that are 4 weeks apart from each other?</description>
      <pubDate>Thu, 21 Oct 2010 20:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20793#M3275</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-21T20:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sparsing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20794#M3276</link>
      <description>Use a DATA step to read-up the data, then use the LAG function and also use INTCK to compute delta/difference between consecutive observations.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 21 Oct 2010 21:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20794#M3276</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-21T21:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sparsing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20795#M3277</link>
      <description>This might get you started.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
   input Code:$2. Date:mmddyy.;&lt;BR /&gt;
   format date mmddyy10.;&lt;BR /&gt;
   cards;&lt;BR /&gt;
A1 4/30/2010&lt;BR /&gt;
B1 5/16/2010&lt;BR /&gt;
C1 5/30/2010&lt;BR /&gt;
D1 6/16/2010&lt;BR /&gt;
E1 4/30/2010&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc distance method=EUCLID out=dist shape=square;&lt;BR /&gt;
   id code;&lt;BR /&gt;
   var interval(date);&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It produces this output.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
 Obs    Code    A1    B1    C1    D1    E1&lt;BR /&gt;
&lt;BR /&gt;
  1      A1      0    16    30    47     0&lt;BR /&gt;
  2      B1     16     0    14    31    16&lt;BR /&gt;
  3      C1     30    14     0    17    30&lt;BR /&gt;
  4      D1     47    31    17     0    47&lt;BR /&gt;
  5      E1      0    16    30    47     0&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 22 Oct 2010 10:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20795#M3277</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-10-22T10:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sparsing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20796#M3278</link>
      <description>Matrix form of output gives a good idea of the spread of the interval.Thanks a lot.</description>
      <pubDate>Fri, 22 Oct 2010 14:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20796#M3278</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-22T14:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sparsing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20797#M3279</link>
      <description>if we are to output the number of weeks instead of days?</description>
      <pubDate>Mon, 25 Oct 2010 17:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20797#M3279</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-10-25T17:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sparsing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20798#M3280</link>
      <description>cartesian join or reflex join are terms to describe "every-way" join&lt;BR /&gt;
why not do all the work your self with an sql step &lt;BR /&gt;
, like (to create the list of code pairs that are 4 weeks apart) &lt;BR /&gt;
/* interval between dates measured in weeks*/[pre]&lt;BR /&gt;
select a.code as code_a&lt;BR /&gt;
     , b.code as code_b&lt;BR /&gt;
     , a.date as date_a&lt;BR /&gt;
     , b.date as date_b &lt;BR /&gt;
     ,    from data a, data b&lt;BR /&gt;
where range( a.date, b.date)/7 =between 3.5 and 4.49 [/pre]&lt;BR /&gt;
or something like that (depending on the "precision" of 4 weeks)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
if you just want counts of the code_a, code_b pairs then &lt;BR /&gt;
use count(*) instead of a.date, b.date in the "select columns list" and group by &lt;BR /&gt;
code_a, code_b</description>
      <pubDate>Fri, 29 Oct 2010 13:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sparsing/m-p/20798#M3280</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-10-29T13:50:24Z</dc:date>
    </item>
  </channel>
</rss>

