<?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: check if variables with different suffix are one on one in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569836#M160622</link>
    <description>&lt;P&gt;Hi! Thanks for the quick response. I think this will work. But I'm also wondering, if now I only know that I have aflag1, bflag1, cflag1, can I use this information to find if aflag2, bflag2, cflag2 exists in the data?&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 14:39:35 GMT</pubDate>
    <dc:creator>laiguanyu001</dc:creator>
    <dc:date>2019-06-28T14:39:35Z</dc:date>
    <item>
      <title>check if variables with different suffix are one on one</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569826#M160617</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am a beginner at SAS.&lt;/P&gt;&lt;P&gt;I have a data set with variable names look like this. aflag1 aflag2 bflag1 bflag2 cflag1 cflag2&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find data where&amp;nbsp; *flag1 value is missing and *flag2 is not missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example if a line in data is aflag1 = '' and aflag2 &amp;lt;&amp;gt; '' then I want to print this line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to strip flag first from variable names and try concatenate them back in data step. But I don't know if this will work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you have any approach to solve this problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 14:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569826#M160617</guid>
      <dc:creator>laiguanyu001</dc:creator>
      <dc:date>2019-06-28T14:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: check if variables with different suffix are one on one</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569831#M160619</link>
      <description>&lt;P&gt;You need two arrays: the first for the flag1-variables (names one), the other one for the flag2-variables (named two, then a loop for checking, the statement "output" to write the observation to the result-dataset and the statement "leave" to avoid duplication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is untested code. Important all flag-variables need to either numeric or alphanumeric for this step to work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;

  array one aflag1 bflag1 cflag1;
  array two aflag2 bflag2 cflag2;

  do i = 1 to dim(one);
    if missing(one[i]) and not missing(two[i]) then do;
      output;
      leave;
    end;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2019 14:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569831#M160619</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-06-28T14:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: check if variables with different suffix are one on one</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569836#M160622</link>
      <description>&lt;P&gt;Hi! Thanks for the quick response. I think this will work. But I'm also wondering, if now I only know that I have aflag1, bflag1, cflag1, can I use this information to find if aflag2, bflag2, cflag2 exists in the data?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 14:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-if-variables-with-different-suffix-are-one-on-one/m-p/569836#M160622</guid>
      <dc:creator>laiguanyu001</dc:creator>
      <dc:date>2019-06-28T14:39:35Z</dc:date>
    </item>
  </channel>
</rss>

