<?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: Prefix for array of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482744#M125102</link>
    <description>&lt;P&gt;Valid SAS names cannot contain dots, only letters, digits and underlines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dot notation is reserved for table aliases in SQL and hash objects in the data step.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jul 2018 09:47:48 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-07-31T09:47:48Z</dc:date>
    <item>
      <title>Prefix for array of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482742#M125101</link>
      <description>&lt;P&gt;May I know how to add a prefix to the variables below, e.g. x.book, x.car, x.ship, x.ball? The number of variables is not fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample;&lt;BR /&gt;input var1 $ var2 $ var3 $ var4 $;&lt;BR /&gt;cards;&lt;BR /&gt;book car ship ball&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 09:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482742#M125101</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2018-07-31T09:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Prefix for array of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482744#M125102</link>
      <description>&lt;P&gt;Valid SAS names cannot contain dots, only letters, digits and underlines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dot notation is reserved for table aliases in SQL and hash objects in the data step.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 09:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482744#M125102</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-31T09:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Prefix for array of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482745#M125103</link>
      <description>&lt;P&gt;If you are looking for an array, it is defined and used like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set sample;
length test $100;
array vars {*} var1-var4;
do i = 1 to dim(vars);
  test = catx(',',test,vars{i});
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 09:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482745#M125103</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-31T09:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Prefix for array of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482748#M125105</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
drop i;

input var1 $ var2 $ var3 $ var4 $;

array vars(*) var:;
array newvars(*) $10. newvar1-newvar4;

do i=1 to dim(vars);
    newvars(i)=cats('x.',vars(i));
end;
cards;
book car ship ball
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 09:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482748#M125105</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-07-31T09:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Prefix for array of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482925#M125163</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With one exception: VALIDVARNAME=ANY. E.g., in this case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option validvarname=any ;                              
                                                       
data sample ;                                          
  input (var1-var4) ($) ;                              
  cards;                                               
  book car ship ball                                   
  ;                                                    
run ;                                                  
                                                       
data _null_ ;                                          
  set sample (rename=(var1-var4="x.var1"n-"x.var4"n)) ;
  put _all_ ;                                          
run ;                                                  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The SAS log will say:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x.var1=book x.var2=car x.var3=ship x.var4=ball _ERROR_=0 _N_=1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Though methinks the poster of the question actually meant to prefix the values of the variables, not their names. Unfortunately, it's one of those situations where the intent can hardly be discerned, and the posted needs to read your opus "How to post code".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 19:41:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prefix-for-array-of-variables/m-p/482925#M125163</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-07-31T19:41:40Z</dc:date>
    </item>
  </channel>
</rss>

