<?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: IML use and read statements created within macros in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474955#M4260</link>
    <description>&lt;P&gt;Whoops!&amp;nbsp; Thanks to Rick for editing my original post!&lt;/P&gt;</description>
    <pubDate>Mon, 02 Jul 2018 15:58:09 GMT</pubDate>
    <dc:creator>VPartridge</dc:creator>
    <dc:date>2018-07-02T15:58:09Z</dc:date>
    <item>
      <title>IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474579#M4248</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I inherited a large set of SAS programs and macros that I need to use to calculate a number of indices on environmental data.&amp;nbsp; I think the programs and macros were developed under SAS v7.&amp;nbsp; I currently have v9.4, with IML v14.3, operating under Windows 64-bit.&amp;nbsp; My SAS programming ability is limited and rusty, and I've had no prior experience with IML.&amp;nbsp; The code I inherited calls macros within macros within macros to do such things as variable name manipulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The point at which I'm stuck right now is a macro which invokes IML, using other macros to generate the dataset and variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologize in advance for the long post -- it shows the errors I get with multiple different attempts at modifying the code.&amp;nbsp; Help will be appreciated!&amp;nbsp; Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The original code (which does not work) in the calling macro was:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IML;
 RESET NONAME;
 ERRFLAG=0;
 USE &amp;amp;dsn VAR%imlvar(&amp;amp;var);
 READ ALL INTO X;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where the dsn name was provided by an earlier call to a different macro and imlvar is another macro, which takes the var variable (provided by an earlier call to yet another macro) and creates a list of indexed variables from other variables, as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let vari=("%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The value of vari returned is ("s1":"s814").&amp;nbsp; (Yes, there are 814 numeric fields in this dataset, in addition to numerous other fields.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The log shows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE ridsn_
NOTE: Line generated by the invoked macro "IMLVAR".
1    *
     -
     79
ERROR 79-322: Expecting a {.

MPRINT(IMLVAR):   VAR* * ( "s1":
MPRINT(TSALL):  "s814");
NOTE: Line generated by the macro variable "VARI".
1      ("s1":"s814")
            -
            22
            200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
              a datetime constant, a missing value, (, (|, ), *, ',', -, =, [, |, }.

ERROR 200-322: The symbol is not recognized and will be ignored.

MPRINT(TSALL):   READ ALL INTO X;
ERROR: No data set is currently open for input.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;After reading up on IML and changing just one thing at a time, I have modified the code (which still doesn't work) numerous times, some of which follow:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With:&lt;BR /&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE (&amp;amp;dsn) VAR{%imlvar(&amp;amp;var)};&lt;BR /&gt;&amp;nbsp;READ ALL INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari="%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE (ridsn_) VAR{
MPRINT(IMLVAR):  * "s1":
NOTE: Line generated by the macro variable "VARI".
1      "s1":"s814"
           -
           22
           200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
              a datetime constant, a missing value, (, (|, ), *, ',', -, =, [, |, }.

ERROR 200-322: The symbol is not recognized and will be ignored.

MPRINT(TSALL):  "s814"} READ ALL INTO X;
ERROR: No data set is currently open for input.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;With:&lt;BR /&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE (&amp;amp;dsn) VAR(%imlvar(&amp;amp;var));&lt;BR /&gt;&amp;nbsp;READ ALL INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari={"%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))"};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE (ridsn_) VAR(
NOTE: Line generated by the invoked macro "IMLVAR".
1    *
     -
     79
ERROR 79-322: Expecting a {.

MPRINT(IMLVAR):  * * ( "s1":
NOTE 137-205: Line generated by the invoked macro "TSALL".
3      PROC IML;   RESET NONAME;   ERRFLAG=0;  USE (&amp;amp;dsn) VAR(%imlvar(&amp;amp;var));  READ ALL INTO X;   RESET LOG;
                                                                           -
                                                                           22
ERROR 22-322: Syntax error, expecting one of the following: ;, NOBS, VAR, VARIABLES, WHERE.

NOTE: Line generated by the invoked macro "TSALL".
3      PROC IML;   RESET NONAME;   ERRFLAG=0;  USE (&amp;amp;dsn) VAR(%imlvar(&amp;amp;var));  READ ALL INTO X;   RESET LOG;
                                                                           -
                                                                           200
ERROR 200-322: The symbol is not recognized and will be ignored.

NOTE: Line generated by the macro variable "VARI".
1      ("s1":"s814")
            -
            79
ERROR 79-322: Expecting a }.

MPRINT(TSALL):  "s814") ) READ ALL INTO X;
ERROR: No data set is currently open for input.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;With:&lt;BR /&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE (&amp;amp;dsn) VAR{%imlvar(&amp;amp;var)};&lt;BR /&gt;&amp;nbsp;READ ALL INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari="%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE (ridsn_) VAR{
MPRINT(IMLVAR):  * * ("s1":
MPRINT(TSALL):  "s814")};
NOTE: Line generated by the macro variable "VARI".
1      ("s1":"s814")
            -
            22
            200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
              a datetime constant, a missing value, (, (|, ), *, ',', -, =, [, |, }.

ERROR 200-322: The symbol is not recognized and will be ignored.

MPRINT(TSALL):   READ ALL INTO X;
ERROR: No data set is currently open for input.

 statement : READ at line 2922 column 75

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;With:&lt;BR /&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE (&amp;amp;dsn);&lt;BR /&gt;&amp;nbsp;READ ALL VAR{%imlvar(&amp;amp;var)} INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari="%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE (ridsn_);
ERROR: No input file specified.

 statement : USE at line 2922 column 43
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
      real time           0.97 seconds
      cpu time            0.75 seconds

MPRINT(TSALL):   READ ALL VAR{
MPRINT(IMLVAR):  * * ("s1":"s814")
MPRINT(TSALL):  } INTO X;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;With:&lt;BR /&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE &amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;READ ALL VAR{%imlvar(&amp;amp;var)} INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari="%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE ridsn_;
MPRINT(TSALL):   READ ALL VAR{
MPRINT(IMLVAR):  * * ("s1":
MPRINT(TSALL):  "s814")} INTO X;
NOTE: Line generated by the macro variable "VARI".
1      ("s1":"s814")
            -
            22
            200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
              a datetime constant, a missing value, (, (|, ), *, ',', -, =, [, |, }.

ERROR 200-322: The symbol is not recognized and will be ignored.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;With:&lt;BR /&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE &amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;READ ALL VAR %imlvar(&amp;amp;var) INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari="%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))":"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE ridsn_;
MPRINT(TSALL):   READ ALL VAR
NOTE: Line generated by the invoked macro "IMLVAR".
1     *
      -
      79
ERROR 79-322: Expecting a {.

MPRINT(IMLVAR):   * * ( "s1":
MPRINT(TSALL):  "s814") INTO X;
NOTE: Line generated by the invoked macro "TSALL".
3      PROC IML;   RESET NONAME;   ERRFLAG=0;  USE &amp;amp;dsn;  READ ALL VAR %imlvar(&amp;amp;var) INTO X;   RESET LOG;
                                                                                           -
                                                                                           79
ERROR 79-322: Expecting a }.

NOTE: Line generated by the macro variable "VARI".
1      ("s1":"s814")
            -
            22
            200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
              a datetime constant, a missing value, (, (|, ), *, ',', -, =, [, |, }.

ERROR 200-322: The symbol is not recognized and will be ignored.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;With:&lt;/P&gt;
&lt;P&gt;PROC IML;&lt;BR /&gt;&amp;nbsp;RESET NONAME;&lt;BR /&gt;&amp;nbsp;ERRFLAG=0;&lt;BR /&gt;&amp;nbsp;USE &amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;READ ALL VAR{%imlvar(&amp;amp;var)} INTO X;&lt;BR /&gt;and&lt;BR /&gt;%let vari="%substr(&amp;amp;var,1,%eval(&amp;amp;i-1))"-"%substr(&amp;amp;var,%eval(&amp;amp;i+1),%eval(%length(&amp;amp;var)-&amp;amp;i))";&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;the errors are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MPRINT(TSALL):   USE ridsn_;
MPRINT(TSALL):   READ ALL VAR{
MPRINT(IMLVAR):  * * * "s1"-"s814"
MPRINT(TSALL):  } INTO X;
NOTE: Line generated by the macro variable "VARI".
1      "s1"-"s814"
            ------
            22
            76
ERROR 22-322: Syntax error, expecting one of the following: a numeric constant, a datetime constant, a missing value.

ERROR 76-322: Syntax error, statement will be ignored.

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 11:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474579#M4248</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-06-30T11:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474594#M4249</link>
      <description>&lt;P&gt;To clarify, since the font in the post doesn't show how the errors line up with the code:&amp;nbsp; All of the 22-322 errors except the last one were about the colon separating the indexed variables.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 22:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474594#M4249</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-06-29T22:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474600#M4250</link>
      <description>&lt;P&gt;When I dispense with trying to generate the variable list from the IMLVAR macro and just use&lt;/P&gt;&lt;P&gt;USE &amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;READ ALL VAR {"s1":"s814"} INTO X;&lt;/P&gt;&lt;P&gt;in the calling program (with or without the curly braces), I still get the 22-322 error complaining about the colon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 22:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474600#M4250</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-06-29T22:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474601#M4251</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218498"&gt;@VPartridge&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;To clarify, since the font in the post doesn't show how the errors line up with the code:&amp;nbsp; All of the 22-322 errors except the last one were about the colon separating the indexed variables.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Post code and log results into a code window. Copy them from your editor or the SAS log. Then open a code box using the {I} icon and paste.&lt;/P&gt;
&lt;P&gt;You will also see the results in a box:&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=collegesurvey;
  vbar gradelevel /group=planstogotocollege groupdisplay=cluster;
run;&lt;/PRE&gt;
&lt;P&gt;The icon that looks like the "running man" next to the {I} also opens a code box that supports some code highlighting and will also preserve spaces better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The main message windows on this forum apparently hate multiple spaces, tabs or other white-space characters and will&amp;nbsp;combine multiples into singles.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 22:59:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474601#M4251</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-29T22:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474608#M4252</link>
      <description>&lt;P&gt;Thanks for the tip on how to post code and logs.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 00:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474608#M4252</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-06-30T00:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474611#M4253</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218498"&gt;@VPartridge&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When I dispense with trying to generate the variable list from the IMLVAR macro and just use&lt;/P&gt;
&lt;P&gt;USE &amp;amp;dsn;&lt;BR /&gt;&amp;nbsp;READ ALL VAR {"s1":"s814"} INTO X;&lt;/P&gt;
&lt;P&gt;in the calling program (with or without the curly braces), I still get the 22-322 error complaining about the colon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is it that you think the colon is doing?&amp;nbsp; If you are trying to specify column or row names don't you need to add the colname= or rowname= keyword to the read statement?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 00:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474611#M4253</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-06-30T00:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474654#M4254</link>
      <description>&lt;P&gt;You can't use the colon inside&amp;nbsp;a character literal.&amp;nbsp;&amp;nbsp; So the correct way is to use ordinary round braces (parentheses):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;READ ALL VAR ("s1":"s814") INTO X;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 11:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474654#M4254</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2018-06-30T11:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474683#M4255</link>
      <description>&lt;P&gt;I see two thing that you probably want to fix. One is the IML syntax for specifying a list of variables names using string literals (as apposed to an IML vector of names).&amp;nbsp; For that you need to use normal parentheses.&lt;/P&gt;
&lt;P&gt;So you can use the IML VAR option on the USE or READ statement. Or you could use the normal SAS syntax for variable ranges if you use the KEEP= dataset option when specifying the source dataset on the USE statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
  input s1-s5 ;
cards;
1 2 3 4 5
6 7 8 9 10
;

proc iml ;
use work.x ;
read all var ("s2":"s4") into x;
print x;

use work.x var ("s2":"s4");
read all into y;
print y;

use work.x(keep=s2-s4) ;
read all into z;
print z;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Second is it looks like your %IMLVAR() macro is emitted some extra garbage.&lt;/P&gt;
&lt;P&gt;From the things you did post it looks like the macro is generating extra * characters.&lt;/P&gt;
&lt;PRE&gt;MPRINT(TSALL):   USE (ridsn_) VAR{
MPRINT(IMLVAR):  * "s1":&lt;/PRE&gt;
&lt;P&gt;that are causing trouble.&lt;/P&gt;
&lt;P&gt;When you are defining this type of "command" or in-line macro make sure that the only non-macro statements are the text that you want the macro to emit.&lt;/P&gt;
&lt;P&gt;Say you want to define macro that will take a base name and start and stop index number and have it generate the IML syntax needed.&lt;/P&gt;
&lt;P&gt;For example you might make a macro like this to emit a variable list in IML format with the quotes and the colon.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro imlvar(base,start,stop);
"&amp;amp;base.&amp;amp;start":"&amp;amp;base.&amp;amp;stop"
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then use it in your IML code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read all var (%imlvar(s,2,4)) into x;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 17:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474683#M4255</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-06-30T17:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474952#M4258</link>
      <description>&lt;P&gt;Thank you, Ian.&amp;nbsp; That worked.&amp;nbsp; (That was about the only combination I hadn't tried!)&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:54:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474952#M4258</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-07-02T15:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474954#M4259</link>
      <description>&lt;P&gt;Thank you, Tom.&amp;nbsp; And thanks also for editing my original post so that it's readable!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474954#M4259</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-07-02T15:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: IML use and read statements created within macros</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474955#M4260</link>
      <description>&lt;P&gt;Whoops!&amp;nbsp; Thanks to Rick for editing my original post!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-use-and-read-statements-created-within-macros/m-p/474955#M4260</guid>
      <dc:creator>VPartridge</dc:creator>
      <dc:date>2018-07-02T15:58:09Z</dc:date>
    </item>
  </channel>
</rss>

