<?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: how to print all obs for an ID that has a flag value &amp;gt; 0 in any of them in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950911#M371802</link>
    <description>&lt;P&gt;Got it. That worked, thanks! I was thinking there was a statement within proc print but good to know a data step was needed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 05:53:08 GMT</pubDate>
    <dc:creator>sasgorilla</dc:creator>
    <dc:date>2024-11-15T05:53:08Z</dc:date>
    <item>
      <title>how to print all obs for an ID that has a flag value &gt; 0 in any of them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950908#M371800</link>
      <description>&lt;P&gt;I created a flag variable where there were duplicate observations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To examine these further, I want to print all observations for IDs that had a flag, not just the particular ones that were flagged. The below code obviously only prints observations with a flag value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=a;
	where flag&amp;gt;0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How can I print all observations for IDs with flags? So for the below, I would want all observations of ID 1 and 3 to be printed since they had a flag value in any of the observations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input id var1 flag;
datalines;
1 1 0
1 1 1
2 3 0
2 2 0
3 1 0
3 2 0
3 1 1
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 05:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950908#M371800</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2024-11-15T05:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to print all obs for an ID that has a flag value &gt; 0 in any of them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950910#M371801</link>
      <description>&lt;P&gt;You can do it like this (data must be sorted by ID, like your sample data):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge a(keep=id flag where=(flag&amp;gt;0) in=ok) a;
  by id;
  if ok;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2024 05:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950910#M371801</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2024-11-15T05:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to print all obs for an ID that has a flag value &gt; 0 in any of them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950911#M371802</link>
      <description>&lt;P&gt;Got it. That worked, thanks! I was thinking there was a statement within proc print but good to know a data step was needed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 05:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-print-all-obs-for-an-ID-that-has-a-flag-value-gt-0-in-any/m-p/950911#M371802</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2024-11-15T05:53:08Z</dc:date>
    </item>
  </channel>
</rss>

