<?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: variables numeric and character start same in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488817#M127456</link>
    <description>&lt;P&gt;Use from-to variable lists:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tab1;
input id x1 x2 x3 x4 x5 x6 $ X7 $;
cards;
1 3 2 2 . 1 a b
1 . 1 1 3 2 . b
1 9 . 3 9 6 . b
1 8 . 7 3 2 a b
1 8 2 . 6 . a b
1 6 5 . . 9 a .
2 1 3 . 8 . . b
2 2 5 8 . . a b
2 3 3 11 . . a b
2 4 3 9 . 10 a b
;
run;

data tab2;
set tab1;
array Xnum(*) x1-x5;
array Xchar(*) x6-x7;
/*Instructions*/
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Aug 2018 10:23:36 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-22T10:23:36Z</dc:date>
    <item>
      <title>Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488814#M127453</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have numeric variables and characters that start with x.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to create two vectors as follows,&amp;nbsp;but I can not.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tab1;&lt;BR /&gt;input id x1 x2 x3 x4 x5 x6 $ X7 $;&lt;BR /&gt;cards;&lt;BR /&gt;1 3 2 2 . 1 a b&lt;BR /&gt;1 . 1 1 3 2 . b&lt;BR /&gt;1 9 . 3 9 6 . b&lt;BR /&gt;1 8 . 7 3 2 a b&lt;BR /&gt;1 8 2 . 6 . a b&lt;BR /&gt;1 6 5 . . 9 a .&lt;BR /&gt;2 1 3 . 8 . . b&lt;BR /&gt;2 2 5 8 . . a b&lt;BR /&gt;2 3 3 11 . . a b&lt;BR /&gt;2 4 3 9 . 10 a b&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data tab2;
set tab1;

array Xnum(*) x: _numeric_;

array Xchar(*) x: _CHARACTER_;

/*Instructions*/
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a possibility to do this in sas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;use these options as functions&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;_numeric_ (x: )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;_character_ (y: )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 10:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488814#M127453</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2018-08-22T10:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488816#M127455</link>
      <description>&lt;P&gt;Just don't specify the x: part:&lt;/P&gt;
&lt;PRE&gt;data tab1;
  input id x1 x2 x3 x4 x5 x6 $ X7 $;cards;1 3 2 2 . 1 a b1 . 1 1 3 2 . b1 9 . 3 9 6 . b1 8 . 7 3 2 a b1 8 2 . 6 . a b1 6 5 . . 9 a .2 1 3 . 8 . . b2 2 5 8 . . a b2 3 3 11 . . a b2 4 3 9 . 10 a b;
run;

data tab2;
  set tab1;  
  array xnum(*) _numeric_;
  array xchar(*) _character_;
/*Instructions*/
run;&lt;/PRE&gt;
&lt;P&gt;True you will need to do a check to see if vname="id" and not do your logic for that one (as id is also numeric).&lt;/P&gt;
&lt;P&gt;Otherwise you will need to build lists of variables from sashelp.vcolumn, which is harder.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 10:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488816#M127455</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-22T10:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488817#M127456</link>
      <description>&lt;P&gt;Use from-to variable lists:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tab1;
input id x1 x2 x3 x4 x5 x6 $ X7 $;
cards;
1 3 2 2 . 1 a b
1 . 1 1 3 2 . b
1 9 . 3 9 6 . b
1 8 . 7 3 2 a b
1 8 2 . 6 . a b
1 6 5 . . 9 a .
2 1 3 . 8 . . b
2 2 5 8 . . a b
2 3 3 11 . . a b
2 4 3 9 . 10 a b
;
run;

data tab2;
set tab1;
array Xnum(*) x1-x5;
array Xchar(*) x6-x7;
/*Instructions*/
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 10:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488817#M127456</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-22T10:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488834#M127468</link>
      <description>&lt;P&gt;Here's a variation that doesn't require you to sort through which are numeric and which are character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;array nums {*} x1-numeric-x7;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;array chars {*} x1-character-x7;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 11:59:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488834#M127468</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-22T11:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488835#M127469</link>
      <description>&lt;P&gt;Learned something new. Thanks, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 12:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488835#M127469</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-22T12:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488908#M127511</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data tab2;
set tab1;
array Xnum(*) x1-numeric-x7;
array Xchar(*) x1-character-x7;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 14:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488908#M127511</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-08-22T14:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Array: variables numeric and character start same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488984#M127533</link>
      <description>&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 17:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-variables-numeric-and-character-start-same/m-p/488984#M127533</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2018-08-22T17:12:05Z</dc:date>
    </item>
  </channel>
</rss>

