<?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: Comparing a row in a dataset with the next row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275082#M54961</link>
    <description>&lt;P&gt;What about transposing data? It becomes trivial in the long form. Are all variables numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2016 19:12:25 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-03T19:12:25Z</dc:date>
    <item>
      <title>Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275049#M54952</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with two rows in it, and 18 variables.&amp;nbsp; The first row contains summary values from other stuff and the second row is my summary of the same values (it's a quality control check).&amp;nbsp; I want to make sure that my totals match the totals from the other source.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, two rows, 18 columns.&amp;nbsp; Looks vaguely like this:&lt;/P&gt;&lt;P&gt;&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; c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c6&amp;nbsp;&amp;nbsp; etc....&lt;/P&gt;&lt;P&gt;all&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; 293&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 284&lt;/P&gt;&lt;P&gt;confirm&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 291 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 284&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And i want to add a row that compares the all value in C4 with the comfirm value for C4, etc.&amp;nbsp; So i end up with this:&lt;/P&gt;&lt;P&gt;&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; c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c6&amp;nbsp;&amp;nbsp; etc....&lt;/P&gt;&lt;P&gt;all&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; 293&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 284&lt;/P&gt;&lt;P&gt;confirm&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 291 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 284&lt;/P&gt;&lt;P&gt;match&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&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; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Megan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pw.&amp;nbsp; Once i get this to work, it'll be applied to about 56 different tables, so it's not that i just don't want to eye scan the values themselves.&amp;nbsp; There are going to be quite a few of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 17:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275049#M54952</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-03T17:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275057#M54954</link>
      <description>&lt;P&gt;I might suggest instead of mixing the two data sources (you don't say how you're doing this) that perhaps using PROC COMPARE may be better option.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275057#M54954</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-03T18:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275058#M54955</link>
      <description>&lt;P&gt;I suppose that could work, but if someone knew how to add another row so that i could have both totals all together with a match flag all in the same table, that'd be ideal.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275058#M54955</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-03T18:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275066#M54959</link>
      <description>&lt;P&gt;Actually, i just looked into and it's not really what i want. I don't want all the flags, i have to pull out everything but the total columns b/c they come back mismatched.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd really like a way to compare row one with row two and create a third row with a flag at the same time.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 18:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275066#M54959</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-03T18:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275082#M54961</link>
      <description>&lt;P&gt;What about transposing data? It becomes trivial in the long form. Are all variables numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275082#M54961</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-03T19:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275083#M54962</link>
      <description>&lt;P&gt;That's what i'm fiddling with now.&amp;nbsp; Yes, they are all numeric, and i just finished transposing both tables and am writing the compare code now.&amp;nbsp; Just wasn't sure it would work so i hadn't updated the post.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275083#M54962</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-03T19:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275086#M54965</link>
      <description>&lt;P&gt;This works, but i'd like to leave the post open in case anyone knows of a function or something that can do it without the transposing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*select out the original all row and rename the variables*/&lt;BR /&gt;data d1_part1_1a_selectrows;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set final.d1_final (drop=_break_ i);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where source=1 and cat_order in (1 7) and grp_order in (1 2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/*rename*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%macro rename;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do i=4 %to 22;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;rename _c&amp;amp;i._=c&amp;amp;i.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%mend;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%rename;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;drop source;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/*Transpose selectrows from wide to long*/&lt;BR /&gt;data d1_part1_2_transpose_all (drop=c: grp_order i);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set d1_part1_1a_selectrows;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array xvar(19) c4-c22;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;do i=1 to 19;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;where grp_char="All";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var=vname(xvar(i));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;total=xvar(i);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*Get totals on your own to compare to the ALL row.*/&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;create table d1_part1_3_confirm as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;select cat_order,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%macro sum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do i=4 %to 22;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sum(C&amp;amp;i.) as C&amp;amp;i.,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%mend;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%sum&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"confirm" as grp_char&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from d1_part1_1a_selectrows&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where cat_order=1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;group by cat_order;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;alter table d1_part1_3_confirm&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;drop cat_order;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;/*Transpose confirm from wide to long*/&lt;BR /&gt;data d1_part1_4_transpose_confirm (drop=c: i);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set d1_part1_3_confirm;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array xvar(19) c4-c22;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;do i=1 to 19;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var=vname(xvar(i));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;total=xvar(i);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/*Merge old with new sums*/&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;create table D1_part1_5_compare as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;select coalescec(a.var, b.var) as var,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;a.total as orig_total,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;b.total as confirm_total,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;case when a.total=b.total then 1 else 0 end as matchflag&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from D1_part1_2_transpose_all a full join D1_part1_4_transpose_confirm b&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;on upcase(a.var)=upcase(b.var);&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275086#M54965</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-03T19:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275091#M54967</link>
      <description>&lt;P&gt;If you really wanted to keep it in wide format you could use arrays/retain/end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Untested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data want;
Set have end=eof;

Array c(*) c1-c20;
Array c_lag(*) clag1-clag20;

Retain clag1-clag20;

If _n_=1 then do;
Do i=1 to dim(c);
C_lag(I) = c(I);
End;

Output;

If eof then do;
Do I=1 to 20;
C(I)=round(c(I)-c_lag(I), 0.1);
End;
Output;
End;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jun 2016 19:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275091#M54967</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-03T19:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275152#M54990</link>
      <description>&lt;PRE&gt;
It would be very easy for IML . Do you want IML code ?
The following is SQL code .


data have;
input c4        c5        c6 ;
cards;  
100    293       284
100    291       284
;
run;
proc transpose data=have(obs=0) out=temp;
 var _all_;
run;
proc sql noprint;
 select catx(' ','range(',_name_,')=0 as ',_name_) into : list separated by ','
  from temp;
 create table matched as
  select &amp;amp;list from have;
quit;
data want;
 set have matched;
run;
 


&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Jun 2016 04:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275152#M54990</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-04T04:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275155#M54992</link>
      <description>&lt;P&gt;Use PROC COMPARE. &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc compare out=want outall
  data=have(obs=1)
  compare=have(firstobs=2)
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might want to create a macro to do it if you need to run it for 56 separate data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jun 2016 05:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275155#M54992</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-06-04T05:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275358#M55052</link>
      <description>&lt;P&gt;Thanks, but proc compare isn't what i want.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 11:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275358#M55052</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-06T11:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275359#M55053</link>
      <description>&lt;P&gt;I don't know what IML code is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And i'm unfamiliar with the range function.&amp;nbsp; I've looked it up now, but the SAS page doesn't have =0 on it.&amp;nbsp; What's that part?&amp;nbsp; I've run what you sent and i see that it's working, but i'm not clear on how selecting "range( c4 )=0 as c4,range( c5 )=0 as c5,range( c6 )=0 as c6" from have gives me the 1/0s that i'm looking at, lol.&amp;nbsp; How did that work??&amp;nbsp; Can you please explain the range()=0 function a little more?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 12:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275359#M55053</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-06-06T12:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing a row in a dataset with the next row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275546#M55102</link>
      <description>In SQL range() compare the min value and max value in a variable/column.
For Example:

range( c4 )=0 

first compare the min value and max value of C4 (e.g.   |max-min|   ) , if it =0 ,C4 should have all the same value.
range( c4 )=0   is a condition statement in SQL , if true ,it will return 1 ,otherwise return 0 .</description>
      <pubDate>Tue, 07 Jun 2016 01:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/m-p/275546#M55102</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-07T01:43:11Z</dc:date>
    </item>
  </channel>
</rss>

