<?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: Arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293344#M61028</link>
    <description>&lt;P&gt;Hello Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I am a bit confused now.&lt;/P&gt;&lt;P&gt;The logic I wanted is that if any of the 8 positions in a row (atleast 1 position)&amp;nbsp;is not missng then we give a "Y".&lt;/P&gt;&lt;P&gt;Same&amp;nbsp;holds for the second array..If any of the 5 positions in a row is non missing we give a "Y".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we say&amp;nbsp;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt; if cmiss(of Bx{*}) ne 8&amp;nbsp; then new_X="Y";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The maximum value is 8 since the length is 8&lt;/P&gt;&lt;P&gt;and if any of the 8 values is missing it wont equal 8 (it is less than &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; and we give "Y"&lt;/P&gt;&lt;P&gt;if&amp;nbsp;cmiss equal to 8 it leaves a blank ....&lt;/P&gt;&lt;P&gt;cmiss value cant be greater than 8 in this case???am i right????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also you have not used a Do Loop like Do i=1 to dim(i)..How can that be possible&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest....&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2016 05:25:53 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2016-08-23T05:25:53Z</dc:date>
    <item>
      <title>Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293326#M61016</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to perform two array steps for two variable groups in the same dataset &lt;STRONG&gt;and then merge the resultant datasets obtained&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is there an &lt;STRONG&gt;easy/better way than the one shown below&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data array1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;set have;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;array Bx{8} Abx1-Abx8;&lt;BR /&gt;do i= 1 to 8;&lt;BR /&gt;if Bx{i} ne " " then new_X="Y";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data array2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;set have;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;array BY{5} NAby1-NAby5;&lt;BR /&gt;do i= 1 to 5;&lt;BR /&gt;if BY{i} ne " " then new_Y="Y";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 04:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293326#M61016</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-08-23T04:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293328#M61018</link>
      <description>&lt;PRE&gt;
Use CMISS() :



data array1;
  set have; 
  array Bx{8} Abx1-Abx8;
 array BY{5} NAby1-NAby5;

if cmiss(of Bx{*})=8  then new_X="Y";
if cmiss(of By{*})=5  then new_Y="Y";
run;


 

&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Aug 2016 04:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293328#M61018</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-23T04:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293330#M61019</link>
      <description>&lt;PRE&gt;

if cmiss(of Bx{*}) ne 8  then new_X="Y";
if cmiss(of By{*}) ne 5  then new_Y="Y";

&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Aug 2016 04:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293330#M61019</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-23T04:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293331#M61020</link>
      <description>&lt;P&gt;So your logic is set new_x to Y if there's at least one value in the array? &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thats what your code currently accomplishes. If so, using CMISS or NMiSS is more efficient.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 04:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293331#M61020</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-23T04:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293333#M61022</link>
      <description>&lt;P&gt;There's absolutely no reason you need to separate those steps. A datastep can have multiple array definitions and loops. Remove the data and set statements in between and your code is combined.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 04:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293333#M61022</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-23T04:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293339#M61023</link>
      <description>&lt;P&gt;Thanks Reeza and Ksharp.&lt;/P&gt;&lt;P&gt;Yes, If there is atleast one non missing value after looping then i set the variable to "Y" and this holds good for both the arrays.&lt;/P&gt;&lt;P&gt;Learnt that Using CMISS is efficient way , since two of you have emphasized , but this below gives the same result as well...?????&lt;/P&gt;&lt;P&gt;My Question is that we are not using Do loop here, and how does SAS know that it has to loop????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pardon my dumb question....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data array;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;set have;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;array Bx{8} Abx1-Abx8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;array BY{5} NAby1-NAby5;&lt;BR /&gt;if Bx{i} ne " " then new_X="Y";&lt;/P&gt;&lt;P&gt;if BY{i} ne " " then new_Y="Y";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;end;&lt;/P&gt;&lt;P&gt;drop i;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 04:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293339#M61023</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-08-23T04:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293341#M61025</link>
      <description>&lt;P&gt;Um...not sure where you came up with that code.&amp;nbsp;It would need a loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Verify the suggestions from KSharp and myself.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 05:01:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293341#M61025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-23T05:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293344#M61028</link>
      <description>&lt;P&gt;Hello Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I am a bit confused now.&lt;/P&gt;&lt;P&gt;The logic I wanted is that if any of the 8 positions in a row (atleast 1 position)&amp;nbsp;is not missng then we give a "Y".&lt;/P&gt;&lt;P&gt;Same&amp;nbsp;holds for the second array..If any of the 5 positions in a row is non missing we give a "Y".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we say&amp;nbsp;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt; if cmiss(of Bx{*}) ne 8&amp;nbsp; then new_X="Y";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The maximum value is 8 since the length is 8&lt;/P&gt;&lt;P&gt;and if any of the 8 values is missing it wont equal 8 (it is less than &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; and we give "Y"&lt;/P&gt;&lt;P&gt;if&amp;nbsp;cmiss equal to 8 it leaves a blank ....&lt;/P&gt;&lt;P&gt;cmiss value cant be greater than 8 in this case???am i right????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also you have not used a Do Loop like Do i=1 to dim(i)..How can that be possible&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest....&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 05:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293344#M61028</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-08-23T05:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293346#M61030</link>
      <description>&lt;P&gt;That's what of bx(*) does. It tells SAS to check all values in the array list.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are other ways to specify variable lists,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Google 'SAS 9.4 Variable lists' and you'll find the documentation regarding variable lists.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 05:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293346#M61030</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-23T05:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293348#M61032</link>
      <description>&lt;P&gt;Just to make sure , this code gives a "Y" if all the values are missing right????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 05:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293348#M61032</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-08-23T05:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293349#M61033</link>
      <description>&lt;P&gt;Wrong.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It matches your requested logic, if any variable in the list is not missing then it is set to Y.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 05:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293349#M61033</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-23T05:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293350#M61034</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I meant this one does not suits my logic because its putting "Y" when all the values of the array are missing!!!&lt;/P&gt;&lt;P&gt;Am i right??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if cmiss(of Bx{*})&amp;nbsp;= 8&amp;nbsp; then new_X="Y";&lt;BR /&gt;if cmiss(of By{*})&amp;nbsp;= 5&amp;nbsp; then new_Y="Y";&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 05:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293350#M61034</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-08-23T05:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293351#M61035</link>
      <description>&lt;P&gt;That's why the code was Not Equals.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im not sure what your trying to do anymore. As long as you test your code thoroughly you should be fine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 06:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293351#M61035</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-23T06:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293363#M61042</link>
      <description>You are correct. Since CMISS() count the missing value of a array, you can't get the number more than the number of members in this array.</description>
      <pubDate>Tue, 23 Aug 2016 07:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/293363#M61042</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-23T07:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/320970#M70779</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have data with transactions amounts every day with cust and trans ids. I want to calcuate sum of transactions and count of transactions for each month by custid using arrays. How do I do?</description>
      <pubDate>Fri, 23 Dec 2016 17:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/320970#M70779</guid>
      <dc:creator>SM3</dc:creator>
      <dc:date>2016-12-23T17:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/320977#M70784</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/95975"&gt;@SM3&lt;/a&gt;&amp;nbsp;please post your question as a new thread. When posting, please include a sample of what your data looks like and what you want as output. It does not have to be real data, post something that illustrates your question. Based on what you've said here, arrays are not the appropriate solution to your question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 18:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/320977#M70784</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-23T18:07:53Z</dc:date>
    </item>
  </channel>
</rss>

