<?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: sas query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/277008#M55569</link>
    <description>&lt;P&gt;And if the rule is the "any of the values are 1" type the modification to my suggested code using an array is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Final_flag = max( of Flag(*));&lt;/P&gt;
&lt;P&gt;if the array of flag variables is named Flag.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 18:02:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-06-13T18:02:02Z</dc:date>
    <item>
      <title>sas query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276981#M55554</link>
      <description>&lt;P&gt;Dear All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have dataset with 7&amp;nbsp;variables. ID, FLAG1-FLAG5, FINAL FLAG..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The purpose of the query is to derive a final flag based on the values of the flag1-flag5.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FLAG1&amp;nbsp;&lt;SPAN&gt; FLAG2&amp;nbsp; FLAG3&amp;nbsp; FLAG4&amp;nbsp; FLAG5&amp;nbsp; FINAL_FLAG&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ABC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1(FLAG1,FLAG2,FLAG4)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DEF&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;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1(FLAG2,FLAG3)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;XYZ&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;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1(FLAG2,FLAG4)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;PTR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Rakesh&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 16:09:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276981#M55554</guid>
      <dc:creator>rakeshvvv</dc:creator>
      <dc:date>2016-06-13T16:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: sas query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276983#M55555</link>
      <description>&lt;P&gt;Is the rule that if any of the flag1 - flag5 is 1 then the result for final flag is 1 otherwise 0?&lt;/P&gt;
&lt;P&gt;If so this may work for you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; final_flag= max(of flag1-flag5);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 16:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276983#M55555</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-13T16:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: sas query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276985#M55557</link>
      <description>&lt;P&gt;Not tested (post test data in the form of a datastep if you want tested code) but:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array flag{5};
  do i=1 to 5;
    if flag{i} then final_flag=catx(final_flag,vname(flag{i});
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2016 16:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276985#M55557</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-13T16:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: sas query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276995#M55563</link>
      <description>&lt;P&gt;Hi , looks like the below arry code will work but can you me out with below&amp;nbsp;variables...they are not following pattern of flag1-flag5 and istead they have name in the flag.....can you help me out......&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SUBJECT CMTRT_Flag &amp;nbsp;CMDOSE_Flag &amp;nbsp;CMUNIT_Flag CMOTSP_Flag &amp;nbsp;CMROUTE_Flag &amp;nbsp;CMROSP_Flag CMFREQ_Flag CMFOSP_Flag &amp;nbsp;CMONGO_Flag CMMHIND_Flag CMAEIND_Flag&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 16:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276995#M55563</guid>
      <dc:creator>rakeshvvv</dc:creator>
      <dc:date>2016-06-13T16:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: sas query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276999#M55564</link>
      <description>&lt;P&gt;Look at the definition of the ARRAY statement.&lt;/P&gt;
&lt;P&gt;I think what you are asking is to change code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ARRAY FLAG (5) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That uses variables named FLAG1 to FLAG5 in the array.&lt;/P&gt;
&lt;P&gt;To code like this that uses the variables you specify in the array.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ARRAY FLAG
     CMTRT_Flag  CMDOSE_Flag  CMUNIT_Flag
     CMOTSP_Flag  CMROUTE_Flag  CMROSP_Flag 
     CMFREQ_Flag CMFOSP_Flag  CMONGO_Flag 
     CMMHIND_Flag CMAEIND_Flag
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that you do not need to tell SAS how many variables are in the array. &amp;nbsp;It will&amp;nbsp;count them for you. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your other code you can use the function call DIM(FLAG) to know how many variables are in the array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 17:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/276999#M55564</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-06-13T17:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: sas query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/277008#M55569</link>
      <description>&lt;P&gt;And if the rule is the "any of the values are 1" type the modification to my suggested code using an array is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Final_flag = max( of Flag(*));&lt;/P&gt;
&lt;P&gt;if the array of flag variables is named Flag.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-query/m-p/277008#M55569</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-13T18:02:02Z</dc:date>
    </item>
  </channel>
</rss>

