<?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: Macro arrays in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113238#M31358</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can simplify your code by using the SQLOBS automatic macro variable.&amp;nbsp; This way you do not need two SQL statements or two passes through the data. When using SQL select into syntax to create a range of macro variables you do not need to set the upperbound exactly. You can just set it to some number large than you ever expect and SAS will only generate the number of variables that match the number of rows selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; color: #000000;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp; select rate&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :alp1 - :alp9999&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from mydata&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;%let nob=&amp;amp;sqlobs;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #000000; background-color: white;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2012 11:20:48 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-09-06T11:20:48Z</dc:date>
    <item>
      <title>Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113236#M31356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create an array with values taken from a data set. 'mydata' is a dataset with 100 observations stored under the column with name 'rate'. I want to store the 100 values into the variables alp1 to alp100 and use them for analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;%macro mymacro; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;proc &lt;/SPAN&gt;sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count(*) into :nob from mydata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select rate&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :alp1 - :alp&amp;amp;nob.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from mydata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;%do I = 1 %to &amp;amp;nob.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (&amp;amp;&amp;amp;alp&amp;amp;I. &amp;gt; 0) %then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&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; ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;%mend mynmacro;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #000000; font-family: arial,helvetica,sans-serif;"&gt;I amgetting an error at the step 'proc sql' . &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #000000; font-family: arial,helvetica,sans-serif;"&gt;Can anyone point out where I am going wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #000000; font-family: arial,helvetica,sans-serif;"&gt;Alternately can anyone suggest a correct approach using macro arrays?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #000000; font-family: arial,helvetica,sans-serif;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 10:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113236#M31356</guid>
      <dc:creator>Raja</dc:creator>
      <dc:date>2012-09-06T10:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113237#M31357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select rate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :alp1 - :alp%left(&amp;amp;nob.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from &lt;SPAN style="color: #ff0000; font-family: 'Courier New'; background-color: #ffffff;"&gt;mydata&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 11:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113237#M31357</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-09-06T11:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113238#M31358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can simplify your code by using the SQLOBS automatic macro variable.&amp;nbsp; This way you do not need two SQL statements or two passes through the data. When using SQL select into syntax to create a range of macro variables you do not need to set the upperbound exactly. You can just set it to some number large than you ever expect and SAS will only generate the number of variables that match the number of rows selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; color: #000000;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp; select rate&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :alp1 - :alp9999&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from mydata&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; background-color: white; color: #000000;"&gt;%let nob=&amp;amp;sqlobs;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #000000; background-color: white;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 11:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113238#M31358</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-09-06T11:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113239#M31359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If this doesn't need to be macro variables (you say "for analysis") then what about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=mydata prefix=alp out=want(drop=_:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; var rate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 11:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113239#M31359</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-09-06T11:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113240#M31360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I would stick with shivas/Tom approach, but for the sake of diversity here's the same thing with datastep:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt; _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set mydata end=_END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput(cats('alp',_N_),rate); * load value;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _END then call symput('nob',_N_); * load count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Cheers from Portugal.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 15:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113240#M31360</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2012-09-06T15:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113241#M31361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;call symputx is better than call symput. look the difference in log file:&lt;/P&gt;&lt;P&gt;data rate;&lt;/P&gt;&lt;P&gt;input rate;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;2 &lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set rate end=_end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput(cats('alp',_N_),rate); * load value;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx(cats('nn',_N_),rate); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _END then call symput('nob',_N_); * load count;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _END then call symputx('n',_N_);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put _user_;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 17:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113241#M31361</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-09-06T17:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113242#M31362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem comes with the value stored in nob, it will be a string with the value "bbbbb100" (where b=blank).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this trick:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count(*) into :nob &lt;STRONG&gt;separated by ' '&lt;/STRONG&gt; from mydata;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 19:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113242#M31362</guid>
      <dc:creator>WaltSmith</dc:creator>
      <dc:date>2012-09-06T19:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113243#M31363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're right Linlin, SYMPUTX is quite handy for removing leading/trailing blanks, but for this particular case, I really don't think it's necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOB/N is just a counter that will probably be used on some %do/%end cycle and I think it really won't make a difference having lead/trails blanks there. I'm guessing that only if you happen to load the value/affect into some alpha variable, then SYMPUTX will come handy. If it's numeric it won't make a difference either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers from Portugal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 07:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113243#M31363</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2012-09-07T07:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113244#M31364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It makes the difference between actually working or failure - if &amp;amp;nob includes leading blanks (and it will using symput rather than symputx) then when &amp;amp;nob is used as attempted above, i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select rate&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :alp1 - :alp&amp;amp;nob.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from mydata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then the "select" would resolve into: "select into :alp1 - alp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100 from mydata;" - and this will fail due to the leading blanks. What is needed in the above is "alp1 - alp100" with no leading blanks ahead of the numeric value. In a %do %end loop the string value of &amp;amp;nob won't matter (as long as its an integer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solutions above that will actually work are shivas, Tom, Linlin and my earlier suggestion (more than one way to write SAS code).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 20:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113244#M31364</guid>
      <dc:creator>WaltSmith</dc:creator>
      <dc:date>2012-09-07T20:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113245#M31365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Walt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was referring to my own/Linlin's proposal of code (loading macros through datastep instead SQL select into), no difference at all. &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I said, NOB/N is to be used certainly in some %do/%end cycle, and it really doesn't matter there if there is trailing or leading blanks, see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%let NOB=&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%do I=&lt;STRONG&gt;1&lt;/STRONG&gt; %to &amp;amp;NOB;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%put PREFIX&amp;amp;I;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;%&lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Cheers from Portugal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2012 07:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113245#M31365</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2012-09-18T07:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113246#M31366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True that in a macro do loop, leading blanks in the value of NOB won't matter, but he wanted to use the value in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select rate&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :alp1 - :alp&amp;amp;nob.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #ff0000; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from mydata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where leading blanks &lt;SPAN style="text-decoration: underline;"&gt;will&lt;/SPAN&gt; matter and cause an error as he said:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;SPAN style="font-size: 10pt; background: white; color: #000000; font-family: arial,helvetica,sans-serif;"&gt;I am getting an error at the step 'proc sql'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: #000000; font-family: arial,helvetica,sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 19:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-arrays/m-p/113246#M31366</guid>
      <dc:creator>WaltSmith</dc:creator>
      <dc:date>2012-09-20T19:38:40Z</dc:date>
    </item>
  </channel>
</rss>

