<?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: Multiple arrays with multiple lengths in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131478#M260643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the variables in your arrays boolean (1/0) values?&lt;/P&gt;&lt;P&gt;If so you sum them to get the number of responses (assuming 1 means response).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data femalea;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set femaleb end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array Factor(*) DX_FIB DX_FII DX_FV DX_FVII DX_FVIII DX_FIX DX_FX DX_FXI DX_FXIII DX_PAI DX_A2_ANTI ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array VWD (*) DX_VW_Type_1 DX_VW_Type_2A DX_VW_Type_2B DX_VW_Type_2M DX_VW_Type_2N DX_VW_Type_3 DX_VW_Type_UK;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array Platelet (*) DX_PLATE_GT DX_PLATE_BS DX_PLATE_GPS DX_PLATE_HPS DX_PLATE_IT DX_PLATE_Storage_Pool DX_PLATE_Release_defect DX_PLATE_Other;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array Connective (*) DX_CON_TIS_Ehlers_Danlos;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ndx = sum(of 0 factor(*) vwd(*) platelet(*) connective(*) );&lt;/P&gt;&lt;P&gt;&amp;nbsp; response = ndx &amp;gt; 1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; total_subjects + response ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if eof then put 'Total number of subjects with more than one DX = ' total_subjects ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note if you just want to sum up the variables that start with DX_ then you can skip the array statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ndx = sum(of DX_: ) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 09 Mar 2013 01:23:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-03-09T01:23:22Z</dc:date>
    <item>
      <title>Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131473#M260638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use multiple arrays to count the number of times each of the conditions occur, but the number of variables in each array is different. I get the following error message when I run this code:&lt;/P&gt;&lt;P&gt;‘Array subscript out of range at line 173 column 4.’&lt;/P&gt;&lt;P&gt;Does anyone know a work around that will allow me to use multiple arrays with different lengths? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data femalea;&lt;/P&gt;&lt;P&gt;set femaleb;&lt;/P&gt;&lt;P&gt;Array Factor (*)&amp;nbsp; DX_FIB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FII&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FVII&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FVIII&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FIX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FXI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_FXIII&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PAI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_A2_ANTI ;&lt;/P&gt;&lt;P&gt;Array VWD (*) DX_VW_Type_1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_VW_Type_2A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_VW_Type_2B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_VW_Type_2M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_VW_Type_2N&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_VW_Type_3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_VW_Type_UK;&lt;/P&gt;&lt;P&gt; Array Platelet (*)DX_PLATE_GT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_BS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_GPS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_HPS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_IT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_Storage_Pool&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_Release_defect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DX_PLATE_Other;&lt;/P&gt;&lt;P&gt;Array Connective DX_CON_TIS_Ehlers_Danlos;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do f = 1 to 15;&lt;/P&gt;&lt;P&gt;&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; if factor(f) =1 and VWD (f)=1 then response =1;&lt;/P&gt;&lt;P&gt;&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; if factor (f) =1 and Platelet (f) =1 then response =1; if factor (f) =1 and Connective (f) =1 then response =1; &lt;/P&gt;&lt;P&gt;&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; if VWD (f) =1 and Platelet (f) =1 then response =1; &lt;/P&gt;&lt;P&gt;&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;&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; end; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 21:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131473#M260638</guid>
      <dc:creator>branbran</dc:creator>
      <dc:date>2013-03-08T21:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131474#M260639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since your using the same index (f) for all arrays its hard to see a work around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How are you expecting to compare factor array and platelet array if they don't have the same number?&lt;/P&gt;&lt;P&gt;Or factor and connective? Or VWD and Platelet?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you might be better off transposing and running a proc freq, but it depends on what you're looking for. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 21:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131474#M260639</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-03-08T21:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131475#M260640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to explain more about what you are really trying to do.&amp;nbsp; Surely you're not trying to recompute the variable 'response' 45 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that was just pseudo code and the question is simply how not to exceed an array's limits, you can always include extra statements like:&lt;/P&gt;&lt;P&gt; if f le dim(DX_VW_Type) then do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for all array references where you con't want to exceed the number of entries in a particular array.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 21:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131475#M260640</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-03-08T21:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131476#M260641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response – You are right this is actually just a step in the process of what I am trying to do. Honestly I am probably making it way more complicated that what it has to be. I am actually trying to create a variable that will count the number of times multiple types of diagnoses occur in one patient. For example a particular patient may have DX_FIB, DX_VW_Type_1, and DX_PLATE_GT. I am trying to create a new variable ‘response” that will count the overall number times multiple diagnoses occur in one patient.&amp;nbsp; Again thanks for your response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 22:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131476#M260641</guid>
      <dc:creator>branbran</dc:creator>
      <dc:date>2013-03-08T22:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131477#M260642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response – You are right this is actually just a step in the process of what I am trying to do. Honestly I am probably making it way more complicated that what it has to be. I am actually trying to create a variable that will count the number of times multiple types of diagnoses occur in one patient. For example a particular patient may have DX_FIB, DX_VW_Type_1, and DX_PLATE_GT. I am trying to create a new variable ‘response” that will count the overall number times multiple diagnoses occur in one patient.&amp;nbsp; Again thanks for your response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 22:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131477#M260642</guid>
      <dc:creator>branbran</dc:creator>
      <dc:date>2013-03-08T22:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131478#M260643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the variables in your arrays boolean (1/0) values?&lt;/P&gt;&lt;P&gt;If so you sum them to get the number of responses (assuming 1 means response).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data femalea;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set femaleb end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array Factor(*) DX_FIB DX_FII DX_FV DX_FVII DX_FVIII DX_FIX DX_FX DX_FXI DX_FXIII DX_PAI DX_A2_ANTI ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array VWD (*) DX_VW_Type_1 DX_VW_Type_2A DX_VW_Type_2B DX_VW_Type_2M DX_VW_Type_2N DX_VW_Type_3 DX_VW_Type_UK;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array Platelet (*) DX_PLATE_GT DX_PLATE_BS DX_PLATE_GPS DX_PLATE_HPS DX_PLATE_IT DX_PLATE_Storage_Pool DX_PLATE_Release_defect DX_PLATE_Other;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array Connective (*) DX_CON_TIS_Ehlers_Danlos;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ndx = sum(of 0 factor(*) vwd(*) platelet(*) connective(*) );&lt;/P&gt;&lt;P&gt;&amp;nbsp; response = ndx &amp;gt; 1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; total_subjects + response ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if eof then put 'Total number of subjects with more than one DX = ' total_subjects ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note if you just want to sum up the variables that start with DX_ then you can skip the array statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ndx = sum(of DX_: ) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 01:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131478#M260643</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-09T01:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple arrays with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131479#M260644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SEE IF THIS HELPS...&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;counter = &lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;*COMPARISON OF ARRAY1 WITH ARRAY2;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;i= DIM(ARRAY1)&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;j= DIM(ARRAY2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;do x= 1 to i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do y= 1 to j;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Counter + (ARRAY1(x)=1 and ARRAY2(y)=1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;REPEAT THE ABOVE STEPS FOR THE OTHER ARRAY COMPARISONS... KEEP THE COUNTER RUNNING WITHOUT RESETTING AND YOU SHOULD HAVE YOUR RESULT&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Mar 2013 00:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-arrays-with-multiple-lengths/m-p/131479#M260644</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2013-03-10T00:36:07Z</dc:date>
    </item>
  </channel>
</rss>

