<?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: Checking whether a group of variables has the same value or not in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716410#M34657</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This particular programming issue is something we have to deal with all the time, so I just de-identified the code and added the messages.&amp;nbsp; Not a programmer except for very specific data manipulations to get stuff in shape for analysis&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2021 12:46:29 GMT</pubDate>
    <dc:creator>SteveDenham</dc:creator>
    <dc:date>2021-02-03T12:46:29Z</dc:date>
    <item>
      <title>Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715970#M34621</link>
      <description>&lt;P&gt;Hi, I would like to check whether a group of variables has the same value for a class or not:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Group&lt;/TD&gt;&lt;TD&gt;Class Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;d&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example group a has different values (1 and 2) but group b has the same values(2 and 2). How do I check this is SAS?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 08:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715970#M34621</guid>
      <dc:creator>Giraffe123</dc:creator>
      <dc:date>2021-02-02T08:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715971#M34622</link>
      <description>&lt;P&gt;What if group b has 2, 2, and 3? Do you&amp;nbsp; want to check if two similar numbers appear within the same group or if all numbers within the same group are equal?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 08:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715971#M34622</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-02T08:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715973#M34623</link>
      <description>&lt;P&gt;Hi, I want to check if&amp;nbsp;&lt;SPAN&gt;all numbers within the same group are equal or not (it doesn't matter to me how many different class values a group has).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 08:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715973#M34623</guid>
      <dc:creator>Giraffe123</dc:creator>
      <dc:date>2021-02-02T08:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715975#M34624</link>
      <description>&lt;P&gt;Ok. This flags groups with different values within the group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Group $ ClassValue;
datalines;
a 1
b 2
a 2
c 2
d 3
b 2
;

proc sort data = have;
   by Group;
run;

data want;

   do _N_ = 1 by 1 until (last.Group);
      set have;
      by Group;
      if lag(ClassValue) ne ClassValue and _N_ ne 1 then flag = 1;
   end;

   do _N_ = 1 to _N_;
      set have;
      output;
   end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2021 08:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715975#M34624</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-02T08:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715977#M34625</link>
      <description>&lt;P&gt;Run proc freq() and check the output report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
  table group*class / nopercent norow nocol;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2021 08:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715977#M34625</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-02T08:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715984#M34626</link>
      <description>Thank you so much!</description>
      <pubDate>Tue, 02 Feb 2021 09:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715984#M34626</guid>
      <dc:creator>Giraffe123</dc:creator>
      <dc:date>2021-02-02T09:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715985#M34627</link>
      <description>Hi, my data set is too big to make proc freq of interactions feasible, but thanks!</description>
      <pubDate>Tue, 02 Feb 2021 09:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715985#M34627</guid>
      <dc:creator>Giraffe123</dc:creator>
      <dc:date>2021-02-02T09:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715987#M34628</link>
      <description>&lt;P&gt;One more approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Group $ ClassValue;
datalines;
a 1
b 2
a 2
c 2
d 3
b 2
;
run;&lt;BR /&gt;
proc sort 
  data = have(keep=Group ClassValue) 
  out = have2 
  nodupkey
;
  by Group ClassValue;
run;

data have2;
  set have2;
  by Group;

  if first.group &amp;gt; last.group then output;
  keep Group;
run;
proc print;
run;

data want;
  declare hash H(dataset:"have2");
  H.defineKey("Group");
  H.defineDone();

  do until(eof);
    set have end=eof;
    flag = ^H.check();
    output;
  end;

  stop;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 09:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/715987#M34628</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-02-02T09:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716036#M34629</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Group $ ClassValue;
datalines;
a 1
b 2
a 2
c 2
d 3
b 2
;

proc sql;
create table want as
select *,count(distinct classvalue)=1 as Has_same_value
 from have
  group by group;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2021 12:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716036#M34629</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-02-02T12:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716077#M34633</link>
      <description>&lt;P&gt;I like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;'s approach.&amp;nbsp; Here is yet another way using PROC MEANS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Group $ ClassValue;
datalines;
a 1
b 2
a 2
c 2
d 3
b 2
;
proc means data=have noprint;
class group;
var classvalue;
output out=want stddev=stddev;
run;

data want2;
length msg $50;
set want;
if _type_=0 then delete;
if stddev=0 then msg='No variability in group';
	else if stddev=. then msg='Insufficient number of observations in group';
	else msg='Variability exists in group';
run;

proc print data=want2;
var msg group;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 14:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716077#M34633</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2021-02-02T14:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716362#M34655</link>
      <description>Steve,&lt;BR /&gt;Are you going to start response sas programming problem ?&lt;BR /&gt;Aren't you just cared about STAT questions ?</description>
      <pubDate>Wed, 03 Feb 2021 10:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716362#M34655</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-02-03T10:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Checking whether a group of variables has the same value or not</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716410#M34657</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This particular programming issue is something we have to deal with all the time, so I just de-identified the code and added the messages.&amp;nbsp; Not a programmer except for very specific data manipulations to get stuff in shape for analysis&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 12:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Checking-whether-a-group-of-variables-has-the-same-value-or-not/m-p/716410#M34657</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2021-02-03T12:46:29Z</dc:date>
    </item>
  </channel>
</rss>

