<?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: array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/array/m-p/349201#M80977</link>
    <description>OK.  I am going the route of creating a new set of character variables so I can double check the old with the new.   Thanks!&lt;BR /&gt;</description>
    <pubDate>Tue, 11 Apr 2017 17:18:19 GMT</pubDate>
    <dc:creator>jcis7</dc:creator>
    <dc:date>2017-04-11T17:18:19Z</dc:date>
    <item>
      <title>array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array/m-p/348950#M80862</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the data below.&lt;/P&gt;
&lt;P&gt;Where population is &amp;gt;=15 and &amp;lt;=25, if there are any pct values &amp;gt;=96, I need to replace the pct value with a 96+ and the associated number value with a --.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where the population is &amp;gt;=26 and &amp;lt;=99, if there are any pct values &amp;gt;=97, I need to replace the pct value with a 97+ and the associated number value with a --.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where the population is &amp;gt;=100, if there are any pct values &amp;gt;=99, I need to replace the pct value with a 99+ and the associated number value with a --.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the SAS code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few questions:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Did I do this right?&lt;/P&gt;
&lt;P&gt;2) When I export to MS Excel and use find/replace (i.e, find&amp;nbsp;-1 and replace with --), why do I come up with 4 more values of -1 than the combined&amp;nbsp;count of -2, -3, and -4?&amp;nbsp; I tried filtering in Excel just for the -1 values to see if the 4 extra -1's didn't have matching -2 or -3 or -4 but I couldn't find any of the extra -1's.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a) Therefore, how do I find any -1 in the SAS dataset (which is only in the num column) that doesn't have a matching -2 or -3 or -4 value?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;b) Why do I have 4 extra -1's?&lt;/P&gt;
&lt;P&gt;c) How can I double check I am getting what I want to get?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input buildingname &amp;amp; $20. population numvax1 pctvax1 numvax2 pctvax2&amp;nbsp;&amp;nbsp; numvax3 pctvax3&amp;nbsp;&amp;nbsp; buildingtype $;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;happy days&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;100 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 99&amp;nbsp;&amp;nbsp; 99&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 96&amp;nbsp;&amp;nbsp; 96&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private&lt;/P&gt;
&lt;P&gt;learning tree&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp; 90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp; 90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 95&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/P&gt;
&lt;P&gt;bean stalk&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;format&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;value pct&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;2&lt;/STRONG&gt;="96+"&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;3&lt;/STRONG&gt;="97+"&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;4&lt;/STRONG&gt;="99+";&lt;/P&gt;
&lt;P&gt;value nm&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;1&lt;/STRONG&gt;="--";&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if&amp;nbsp;population &amp;gt;=&lt;STRONG&gt;15&lt;/STRONG&gt;;;&lt;/P&gt;
&lt;P&gt;array pcts{*} pct_:;&lt;/P&gt;
&lt;P&gt;array nums{*} num_:;&lt;/P&gt;
&lt;P&gt;do i=&lt;STRONG&gt;1&lt;/STRONG&gt; to dim(pcts);&lt;/P&gt;
&lt;P&gt;if &lt;STRONG&gt;15&lt;/STRONG&gt;=&amp;lt;population&amp;lt;=&lt;STRONG&gt;25&lt;/STRONG&gt; and pcts{i}&amp;gt;=&lt;STRONG&gt;96&lt;/STRONG&gt;then nums{i}=-&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;if &lt;STRONG&gt;15&lt;/STRONG&gt;=&amp;lt;population&amp;lt;=&lt;STRONG&gt;25&lt;/STRONG&gt; and pcts{i}&amp;gt;=&lt;STRONG&gt;96&lt;/STRONG&gt; then pcts{i}=-&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if &lt;STRONG&gt;26&lt;/STRONG&gt;=&amp;lt;population&amp;lt;=&lt;STRONG&gt;99&lt;/STRONG&gt; and pcts{i}&amp;gt;=&lt;STRONG&gt;97&lt;/STRONG&gt; then nums{i}=-&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;if &lt;STRONG&gt;26&lt;/STRONG&gt;=&amp;lt;population&amp;lt;=&lt;STRONG&gt;99&lt;/STRONG&gt; and pcts{i}&amp;gt;=&lt;STRONG&gt;97&lt;/STRONG&gt; then pcts{i}=-&lt;STRONG&gt;3&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if population&amp;gt;=&lt;STRONG&gt;100&lt;/STRONG&gt; and pcts{i}&amp;gt;=&lt;STRONG&gt;99&lt;/STRONG&gt; then nums{i}=-&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;if population&amp;gt;=&lt;STRONG&gt;100&lt;/STRONG&gt; and pcts{i}&amp;gt;=&lt;STRONG&gt;99&lt;/STRONG&gt; then pcts{i}=-&lt;STRONG&gt;4&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;format pct_: pct.;&lt;/P&gt;
&lt;P&gt;format num_: nm.;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 02:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array/m-p/348950#M80862</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2017-04-11T02:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array/m-p/348958#M80866</link>
      <description>&lt;P&gt;There are no underscores in your num and pct variables. Rather than:&lt;/P&gt;
&lt;PRE&gt;array pcts{*} pct_:;
array nums{*} num_:;
&lt;/PRE&gt;
&lt;P&gt;I think you want:&lt;/P&gt;
&lt;PRE&gt;array pcts{*} pct:;
array nums{*} num:;
&lt;/PRE&gt;
&lt;P&gt;If your problem is more than that, you would have to show the resulting table that you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 03:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array/m-p/348958#M80866</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-11T03:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array/m-p/349159#M80954</link>
      <description>&lt;P&gt;I tend to not replace variables when doing this type of recoding as it makes answering your questions about what happened when I recode hard to tell.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would have to provide both the start and end data for the Excel you created. And since the code you post, per &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;'s comment would not run unless you have variables that you did not include in your example data you would have to show either the data or the actual code.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 15:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array/m-p/349159#M80954</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-11T15:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array/m-p/349200#M80976</link>
      <description>Thanks!&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Apr 2017 17:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array/m-p/349200#M80976</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2017-04-11T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array/m-p/349201#M80977</link>
      <description>OK.  I am going the route of creating a new set of character variables so I can double check the old with the new.   Thanks!&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Apr 2017 17:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array/m-p/349201#M80977</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2017-04-11T17:18:19Z</dc:date>
    </item>
  </channel>
</rss>

