<?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: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369266#M88143</link>
    <description>I thought of compiling once and then wondered if i then select my own compiling as for solution would look like taking the credit of others' work.</description>
    <pubDate>Wed, 21 Jun 2017 18:39:00 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2017-06-21T18:39:00Z</dc:date>
    <item>
      <title>HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369242#M88130</link>
      <description>&lt;P&gt;My survey data has group&amp;nbsp;variables such as&amp;nbsp;A1-A10, B1-B2, C1-C5, D1-D15...so forth so on. And I'd like to exclude &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; in following data step. &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; has missing (.) . I don't need to shift &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; by +1 to the right.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1(drop=i); set have;
array shift[*] _numeric_;
do i=1 to dim(shift);
if shift(i) not in ('D:') then shift(i)=shift(i)+1;
end;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1(drop=i); set have;
array shift[*] _numeric_;
do i=1 to dim(shift);
shift(i)=shift(i)+1;&lt;BR /&gt;end;&lt;BR /&gt;where _numeric_ not in ('D:');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The codes above didn't work. &amp;nbsp;Any suggestions please?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 17:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369242#M88130</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-06-21T17:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369243#M88131</link>
      <description>&lt;P&gt;I think you are asking how to conditionally execute based on the NAME of particular variable in a an ARRAY?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array shift _numeric_;
  do i=1 to dim(shift);
    if upcase(vname(shift(i))) ^=: 'D' then shift(i)=shift(i)+1;
  end;
  drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2017 18:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369243#M88131</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-21T18:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369246#M88133</link>
      <description>&lt;P&gt;You would have to test the name of the variable.&lt;/P&gt;
&lt;P&gt;Something like this is one way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;if upcase(substr( vname(shift[i]), &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;)) ne &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'D'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; then &lt;/FONT&gt;&amp;lt;whatever&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the following data step use drop on the SET statement if you don't want it:&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;&amp;nbsp; set have (drop= &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; );&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;The : says to consider all variables that start with D as a group and drop them. If you have other variables such as DATE then another&lt;/P&gt;
&lt;P&gt;set have (drop= D1-D15) will use the listed variables and remove D1 through D15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The concept here is variable list. There are several forms available in SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 18:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369246#M88133</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-21T18:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369250#M88135</link>
      <description>&lt;P&gt;Following up on&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;post here is a method to create the array without the "D" variables, but keep then in the dataset.&lt;/P&gt;
&lt;P&gt;You can take advantage of the fact that variable lists values depend on where they appear in the data step. The _NUMERIC_ variable list will only find the vairables that have already beed defined. &amp;nbsp;You can then SET the dataset again and read in all of the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have (drop=D:);
  array shift _numeric_;
  set have ;
  do over shift;
     shift=shift+1;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2017 18:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369250#M88135</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-21T18:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369253#M88136</link>
      <description>&lt;P&gt;In this case I would suggest also consider not using the list _numeric_.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could either list them out separately or somehow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array myvars (*) A: B: C: E: ... etc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 18:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369253#M88136</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-21T18:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369260#M88139</link>
      <description>&lt;P&gt;All worked out. What in general happens when you find more than one solutions worked out from multiple advisors? I probably have to post this in the community matter?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 18:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369260#M88139</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-06-21T18:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369265#M88142</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@SUNY_Maggie wrote:&lt;BR /&gt;
&lt;P&gt;All worked out. What in general happens when you find more than one solutions worked out from multiple advisors? I probably have to post this in the community matter?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think it really matters. Pick the solution that's the closest to what you need. If you end up compiling things from multiple people it's also ok to post the full solution in one place and mark that as the answer. The 'goal' of answering should be to inform someone searching as to which answer is correct for this problem, and yes there may be more than one.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 18:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369265#M88142</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-21T18:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369266#M88143</link>
      <description>I thought of compiling once and then wondered if i then select my own compiling as for solution would look like taking the credit of others' work.</description>
      <pubDate>Wed, 21 Jun 2017 18:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369266#M88143</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-06-21T18:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369279#M88148</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@SUNY_Maggie wrote:&lt;BR /&gt;I thought of compiling once and then wondered if i then select my own compiling as for solution would look like taking the credit of others' work.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are situations where that is appropriate and others where it's not. If you do that for all your questions, it's likely you're not making the correct decision but I think you're worrying about this too much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 19:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369279#M88148</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-21T19:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO EXCLUDE GROUP VARIABLE FROM THE ARRAY FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369280#M88149</link>
      <description>Ok. Thanks Reeza.</description>
      <pubDate>Wed, 21 Jun 2017 19:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-EXCLUDE-GROUP-VARIABLE-FROM-THE-ARRAY-FUNCTION/m-p/369280#M88149</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-06-21T19:05:40Z</dc:date>
    </item>
  </channel>
</rss>

