<?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 variable in a DATA Step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469448#M285526</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%let sink = T3_R230;

data solution_distance_data_single;
set solution_&amp;amp;source._to_&amp;amp;sink.;
source = &amp;amp;source;
sink = "&amp;amp;sink";
/*distance = sum(edge);*/
/*drop i, j, flow, edge; */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jun 2018 23:04:18 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-06-11T23:04:18Z</dc:date>
    <item>
      <title>macro variable in a DATA Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469444#M285523</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Hi!  Been a long time since I've used sas.  I apologize if there is a simple solution I am missing.&lt;BR /&gt;&lt;BR /&gt;I'm trying to use macro variables in the set statement of a data step in the following manner:&lt;BR /&gt;&lt;BR /&gt;%let source = "T4_R283";
%let sink = "T3_R230";

data solution_distance_data_single;
set "solution_&amp;amp;source._to_&amp;amp;sink."
source = &amp;amp;source;
sink = &amp;amp;sink;
/*distance = sum(edge);*/
/*drop i, j, flow, edge; */
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm trying to get the set name to be "solution_T4_R283_to_T3_R230" but I get the following error lines in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;254 set "solution_&amp;amp;source._to_&amp;amp;sink."&lt;BR /&gt;NOTE: Line generated by the macro variable "SINK".&lt;BR /&gt;254 "solution_"T4_R283"_to_"T3_R230"&lt;BR /&gt;____________&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,&lt;BR /&gt;NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use periods to delineate the macro variables from the string, what else do I need to do?&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;</description>
      <pubDate>Mon, 11 Jun 2018 22:58:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469444#M285523</guid>
      <dc:creator>yus03590</dc:creator>
      <dc:date>2018-06-11T22:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in a DATA Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469446#M285524</link>
      <description>&lt;P&gt;Are you using named literals?&lt;BR /&gt;Is there a specific reason you have the data set name in quotes, it usually isn't unless you're using name literals which would need an N at the end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you show working code - without any macros? Then it's much easier to convert it to a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181365"&gt;@yus03590&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Hi!  Been a long time since I've used sas.  I apologize if there is a simple solution I am missing.&lt;BR /&gt;&lt;BR /&gt;I'm trying to use macro variables in the set statement of a data step in the following manner:&lt;BR /&gt;&lt;BR /&gt;%let source = "T4_R283";
%let sink = "T3_R230";

data solution_distance_data_single;
set "solution_&amp;amp;source._to_&amp;amp;sink."
source = &amp;amp;source;
sink = &amp;amp;sink;
/*distance = sum(edge);*/
/*drop i, j, flow, edge; */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm trying to get the set name to be "solution_T4_R283_to_T3_R230" but I get the following error lines in the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;254 set "solution_&amp;amp;source._to_&amp;amp;sink."&lt;BR /&gt;NOTE: Line generated by the macro variable "SINK".&lt;BR /&gt;254 "solution_"T4_R283"_to_"T3_R230"&lt;BR /&gt;____________&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,&lt;BR /&gt;NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;/P&gt;
&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use periods to delineate the macro variables from the string, what else do I need to do?&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;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 23:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469446#M285524</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-11T23:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in a DATA Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469447#M285525</link>
      <description>&lt;P&gt;Don't use quotes in the %let.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 23:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469447#M285525</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-11T23:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in a DATA Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469448#M285526</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%let sink = T3_R230;

data solution_distance_data_single;
set solution_&amp;amp;source._to_&amp;amp;sink.;
source = &amp;amp;source;
sink = "&amp;amp;sink";
/*distance = sum(edge);*/
/*drop i, j, flow, edge; */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 23:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469448#M285526</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-11T23:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in a DATA Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469524#M285527</link>
      <description>&lt;P&gt;when we use quotes for macro it resolves with the quotes i.e.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;%let a = "sas";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%put &amp;amp;=a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a="sas"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope I made it clear&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 06:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-a-DATA-Step/m-p/469524#M285527</guid>
      <dc:creator>ruchi11dec</dc:creator>
      <dc:date>2018-06-12T06:33:44Z</dc:date>
    </item>
  </channel>
</rss>

