<?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: A little help with &amp;quot;array&amp;quot; -- I think... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797430#M287526</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If the situation is more complicated, and you need to use the list of variables names in multiple places in your program, you can put the list of variables in a macro variable and then wherever you need this list, you use the name of the macro variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;Yes,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;, that's the case.&amp;nbsp; Given the above, how would that look using a macro approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The actual, as one would suppose, involves even more much longer named variables picked from throughout the dataset used several times within a program.&amp;nbsp; Quite a large block to deal with and see repeatedly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Feb 2022 23:16:23 GMT</pubDate>
    <dc:creator>NKormanik</dc:creator>
    <dc:date>2022-02-19T23:16:23Z</dc:date>
    <item>
      <title>A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797367#M287472</link>
      <description>&lt;P&gt;Trying to get a grasp of SAS arrays.&amp;nbsp; I may have things all wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array &lt;FONT color="#993300"&gt;&lt;STRONG&gt;input_variables_array&lt;/STRONG&gt;&lt;/FONT&gt; (*)
a b c d e f g h i j k l m n o p q r s t u v w x y z;

proc hplogistic data=sas_1.combined outest gconv=0;
model i_50505_Z_top20pct (event='1')
= &lt;FONT color="#993300"&gt;&lt;STRONG&gt;input_variables_array&lt;/STRONG&gt;&lt;/FONT&gt;;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All variables are numeric.&amp;nbsp; I created the array, right?&amp;nbsp; Then I wanted to use it in the proc hplogistic, instead of writing out the whole alphabet again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I doing wrong here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nicholas Kormanik&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 09:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797367#M287472</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2022-02-19T09:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797369#M287473</link>
      <description>Arrays are temporary.  They exist within a DATA step only, then vanish when the DATA step ends.</description>
      <pubDate>Sat, 19 Feb 2022 09:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797369#M287473</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-02-19T09:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797373#M287477</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I created the array, right?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, no, you gave us a partial code without context, but it really doesn't matter because ARRAYs have no meaning to SAS PROCs. They are only useable in DATA steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are going to type out&amp;nbsp; all variable names, do it in the PROC, not in a DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, you can always use valid SAS lists of variables, so if these variables are consecutive within a DATA set, you can use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;model i_50505_Z_top20pct (event='1') = a--z;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the double-dash indicating to use variables that are consecutive in the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, if the situation is more complicated, and you need to use the list of variables names in multiple places in your program, you can put the list of variables in a macro variable and then wherever you need this list, you use the name of the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 12:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797373#M287477</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-19T12:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797430#M287526</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If the situation is more complicated, and you need to use the list of variables names in multiple places in your program, you can put the list of variables in a macro variable and then wherever you need this list, you use the name of the macro variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;Yes,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;, that's the case.&amp;nbsp; Given the above, how would that look using a macro approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The actual, as one would suppose, involves even more much longer named variables picked from throughout the dataset used several times within a program.&amp;nbsp; Quite a large block to deal with and see repeatedly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 23:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797430#M287526</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2022-02-19T23:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797433#M287529</link>
      <description>&lt;P&gt;That is what the macro processor is for.&amp;nbsp; Store the text you need to insert into your code into a macro variable.&amp;nbsp; Then just expand the macro variable where you want that text inserted.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let varlist=a b c d e f g h i j k l m n o p q r s t u v w x y z;

proc hplogistic data=sas_1.combined outest gconv=0;
model i_50505_Z_top20pct (event='1') = &amp;amp;varlist. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Feb 2022 00:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797433#M287529</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-20T00:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797436#M287531</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; That considerably cleans thing up.&amp;nbsp; Thanks a bunch!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 01:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797436#M287531</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2022-02-20T01:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: A little help with "array" -- I think...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797452#M287545</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22691"&gt;@NKormanik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If the situation is more complicated, and you need to use the list of variables names in multiple places in your program, you can put the list of variables in a macro variable and then wherever you need this list, you use the name of the macro variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;Yes,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;, that's the case.&amp;nbsp; Given the above, how would that look using a macro approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The actual, as one would suppose, involves even more much longer named variables picked from throughout the dataset used several times within a program.&amp;nbsp; Quite a large block to deal with and see repeatedly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First, let's straighten out the terminology. I was not talking about "using a macro". I did suggest using a macro variable. Macro variable and macros are two different things. You should not call a macro variable by the name "macro", and vice versa.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; shows how to use a macro variable. It's really very simple. If you have lots of variables, with long names, and there is something consistent about them (either common names, or consecutive in your data set), you can use SQL to create this macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example to choose certain variable names not beginning with the letter S from data set SASHELP.CLASS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select name into :varlist separated by ' ' 
        from dictionary.columns where name net 'S' and memname='CLASS' and libname='SASHELP';
quit;
%put &amp;amp;=varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 10:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-little-help-with-quot-array-quot-I-think/m-p/797452#M287545</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-20T10:23:25Z</dc:date>
    </item>
  </channel>
</rss>

