<?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: initializing a flag in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562463#M157562</link>
    <description>&lt;P&gt;This is an inital code that i've written.&lt;/P&gt;&lt;P&gt;data three; set tmp1.lesson2emergencyvisits;&lt;BR /&gt;array cpt $ cpt1-cpt10;&lt;BR /&gt;a_one=0;&lt;BR /&gt;a_two=0;&lt;BR /&gt;a_three=0;&lt;BR /&gt;a_four=0;&lt;BR /&gt;a_five=0;&lt;BR /&gt;do over cpt;&lt;BR /&gt;if cpt= '99281' then flag= a_one+1;&lt;BR /&gt;if cpt = '99282' then flag2 = a_two+1;&lt;BR /&gt;if cpt = '99283' then flag3 = a_three+1;&lt;BR /&gt;if cpt = '99284' then flag4= a_four+1;&lt;BR /&gt;if cpt = '99285' then flag5 = a_five+1;&lt;BR /&gt;end; run;&lt;/P&gt;&lt;P&gt;proc freq data= three; table flag; run;&lt;/P&gt;&lt;P&gt;proc freq data=three; table flag1*flag2*flag3*flag4*flag5/list; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a flag and then&amp;nbsp; to get all the observations in each flag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 May 2019 02:03:22 GMT</pubDate>
    <dc:creator>ChuksManuel</dc:creator>
    <dc:date>2019-05-30T02:03:22Z</dc:date>
    <item>
      <title>initializing a flag</title>
      <link>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562451#M157557</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 10 Cpt codes for emergency visits (cpt1-cpt10). And the ER visit codes are from 99281, 99282, 99283, 99284 and 99285 (in increasing order of patient severity)... I want to find out how many of each of these ER visit codes there are in the dataset. Do i need to use an array and initialize a flag statement?&lt;/P&gt;&lt;P&gt;My a subset of my data looks like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29875iCF24ABB84753C04B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 00:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562451#M157557</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-05-30T00:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: initializing a flag</title>
      <link>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562463#M157562</link>
      <description>&lt;P&gt;This is an inital code that i've written.&lt;/P&gt;&lt;P&gt;data three; set tmp1.lesson2emergencyvisits;&lt;BR /&gt;array cpt $ cpt1-cpt10;&lt;BR /&gt;a_one=0;&lt;BR /&gt;a_two=0;&lt;BR /&gt;a_three=0;&lt;BR /&gt;a_four=0;&lt;BR /&gt;a_five=0;&lt;BR /&gt;do over cpt;&lt;BR /&gt;if cpt= '99281' then flag= a_one+1;&lt;BR /&gt;if cpt = '99282' then flag2 = a_two+1;&lt;BR /&gt;if cpt = '99283' then flag3 = a_three+1;&lt;BR /&gt;if cpt = '99284' then flag4= a_four+1;&lt;BR /&gt;if cpt = '99285' then flag5 = a_five+1;&lt;BR /&gt;end; run;&lt;/P&gt;&lt;P&gt;proc freq data= three; table flag; run;&lt;/P&gt;&lt;P&gt;proc freq data=three; table flag1*flag2*flag3*flag4*flag5/list; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a flag and then&amp;nbsp; to get all the observations in each flag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 02:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562463#M157562</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-05-30T02:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: initializing a flag</title>
      <link>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562476#M157564</link>
      <description>Your sample program is only vaguely related to your description of the problem.  Using the description as a guide, there is no need to create a flag.  Instead, here is what would go inside your DO loop:&lt;BR /&gt;&lt;BR /&gt;do over cpt;&lt;BR /&gt;if cpt in ('99281', '99282', '99283', '99284', '99285')&lt;BR /&gt;then do;&lt;BR /&gt;code = cpt;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;Then after the DATA step is complete:&lt;BR /&gt;&lt;BR /&gt;proc freq;&lt;BR /&gt;tables code;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Of course, this could be totally wrong.  &lt;BR /&gt;&lt;BR /&gt;On a side note, have you considered using a more modern syntax for arrays?  SAS stopped supporting implicit arrays in the 1980s.</description>
      <pubDate>Thu, 30 May 2019 06:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/initializing-a-flag/m-p/562476#M157564</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-30T06:07:40Z</dc:date>
    </item>
  </channel>
</rss>

