<?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: SAS Numbered Range Lists and Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547542#M151745</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp; Already gave you the answer.&lt;/P&gt;
&lt;P&gt;Consider this test program.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;
* Comment without closing semi-colon
%let xx=macro var assignment;
data x;
 set y;
run;
%mend test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See what happens when you run it:&lt;/P&gt;
&lt;PRE&gt;293  options mprint;
294  %test;
MPRINT(TEST):   * Comment without closing semi-colon data x;
NOTE: Line generated by the invoked macro "TEST".
294            set y;
               ---
               180
MPRINT(TEST):   set y;

ERROR 180-322: Statement is not valid or it is used out of proper order.

MPRINT(TEST):   run;&lt;/PRE&gt;
&lt;P&gt;If you are really running the exact same file then check and make sure you have not truncated the ends of the lines on the "mainframe" version.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2019 03:12:55 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-04-01T03:12:55Z</dc:date>
    <item>
      <title>SAS Numbered Range Lists and Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547082#M151551</link>
      <description>&lt;P&gt;I have a Dataset (It's the MXG ASUM70PR) that stores it's data in wide format. I want to convert it to narrow format using PROC&amp;nbsp; TRANSPOSE, but the only problem is that the field names are not conducive for this routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I set up a macro to convert the names:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro set0(suff) ;&lt;BR /&gt;* 123456789012345678901234567890123456&lt;BR /&gt;%LET LPSEQ =0123456789ABCDEFGHIJKLMNOQRSTUVWXYZ;&lt;BR /&gt;%LET LQSEQ =123456789ABCDEFGHIJKLMNOPQ;&lt;BR /&gt;&lt;BR /&gt;%put start OF LP LOOP;&lt;BR /&gt;%do j=1 %to 35;&lt;BR /&gt;%let name = LP%substr(&amp;amp;LPSEQ,&amp;amp;j,1)&amp;amp;suff;&lt;BR /&gt;%let i = %eval(&amp;amp;j-1);&lt;BR /&gt;%put &amp;amp;suff&amp;amp;I = &amp;amp;name ;&lt;BR /&gt;&amp;amp;suff&amp;amp;I = &amp;amp;name ;&lt;BR /&gt;%end;&lt;BR /&gt;%put start OF LQ LOOP;&lt;BR /&gt;%do j=1 %to 26;&lt;BR /&gt;%let Name = LQ%substr(&amp;amp;LQSEQ,&amp;amp;j,1)&amp;amp;suff;&lt;BR /&gt;%let i = %eval(35+&amp;amp;j);&lt;BR /&gt;%put &amp;amp;suff&amp;amp;i = &amp;amp;name ;&lt;BR /&gt;&amp;amp;suff&amp;amp;i = &amp;amp;name ;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test0 (keep = startime name0-name60);&lt;BR /&gt;set &amp;amp;PDB_DAY..asum70pr;&lt;BR /&gt;%set0(NAME);&lt;BR /&gt;&lt;BR /&gt;proc contents;&lt;BR /&gt;proc print;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the field NAME0 does not appear in the resultant data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2019 02:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547082#M151551</guid>
      <dc:creator>Johnsholliday</dc:creator>
      <dc:date>2019-03-29T02:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Numbered Range Lists and Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547086#M151553</link>
      <description>&lt;P&gt;1. Paste code using the {i} or the running man icon&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. It works for me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro set0(suff) ;
  * 123456789012345678901234567890123456;
  %let LPSEQ =0123456789ABCDEFGHIJKLMNOQRSTUVWXYZ;
  %let LQSEQ =123456789ABCDEFGHIJKLMNOPQ;

  %put start OF LP LOOP;
  %do j=1 %to 35;
    %let name = LP%substr(&amp;amp;LPSEQ,&amp;amp;j,1)&amp;amp;suff;
    %let i = %eval(&amp;amp;j-1);
    %put &amp;amp;suff&amp;amp;I = &amp;amp;name ;
    &amp;amp;suff&amp;amp;I = &amp;amp;name ;
  %end;
  %put start OF LQ LOOP;
  %do j=1 %to 26;
    %let Name = LQ%substr(&amp;amp;LQSEQ,&amp;amp;j,1)&amp;amp;suff;
    %let i = %eval(35+&amp;amp;j);
    %put &amp;amp;suff&amp;amp;i = &amp;amp;name ;
    &amp;amp;suff&amp;amp;i = &amp;amp;name ;
  %end;
%mend;

data test0 (keep = startime name0-name60);
  *set &amp;amp;PDB_DAY..asum70pr;
  %set0(NAME);
run;

proc contents; run;
proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 359px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28304i92B5A37FB51FF799/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2019 02:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547086#M151553</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-03-29T02:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Numbered Range Lists and Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547104#M151562</link>
      <description>Looks like you are missing a semicolon at the end of the first line of the macro.</description>
      <pubDate>Fri, 29 Mar 2019 05:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547104#M151562</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-29T05:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Numbered Range Lists and Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547128#M151572</link>
      <description>&lt;P&gt;Do the transpose from your original dataset.&lt;/P&gt;
&lt;P&gt;Convert your macro code to a data step that creates a cntlin dataset for proc format.&lt;/P&gt;
&lt;P&gt;Use the resulting format to change the _name_ column in the transposed dataset.&lt;/P&gt;
&lt;P&gt;Code for creating the format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cntlin;
LPSEQ = "0123456789ABCDEFGHIJKLMNOQRSTUVWXYZ";
LQSEQ = "123456789ABCDEFGHIJKLMNOPQ";
fmtname = 'myfmt';
type = 'C';
do j = 1 to 35;
  start = cats("LP",substr(LPSEQ,j,1),"NAME");
  label = cats("NAME",j-1);
  output;
end;
do j = 1 to 26;
  start = cats('LQ',substr(LQSEQ,j,1),"NAME");
  label = cats("NAME",j+35);
  output;
end;
drop lqseq lpseq j;
run;

proc format cntlin=cntlin;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Mar 2019 09:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547128#M151572</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-29T09:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Numbered Range Lists and Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547523#M151736</link>
      <description>&lt;P&gt;Thanks so much for the replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like this is a bug with the Mainframe Version of SAS. When I Run the Code on the PC It works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have opened a case with SAS.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2019 22:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547523#M151736</guid>
      <dc:creator>Johnsholliday</dc:creator>
      <dc:date>2019-03-31T22:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Numbered Range Lists and Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547542#M151745</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp; Already gave you the answer.&lt;/P&gt;
&lt;P&gt;Consider this test program.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;
* Comment without closing semi-colon
%let xx=macro var assignment;
data x;
 set y;
run;
%mend test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See what happens when you run it:&lt;/P&gt;
&lt;PRE&gt;293  options mprint;
294  %test;
MPRINT(TEST):   * Comment without closing semi-colon data x;
NOTE: Line generated by the invoked macro "TEST".
294            set y;
               ---
               180
MPRINT(TEST):   set y;

ERROR 180-322: Statement is not valid or it is used out of proper order.

MPRINT(TEST):   run;&lt;/PRE&gt;
&lt;P&gt;If you are really running the exact same file then check and make sure you have not truncated the ends of the lines on the "mainframe" version.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 03:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Numbered-Range-Lists-and-Macro/m-p/547542#M151745</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-01T03:12:55Z</dc:date>
    </item>
  </channel>
</rss>

