<?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: Can't use macro variable in proc CAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683902#M207187</link>
    <description>&lt;P&gt;Thansks, I did not know about cas spesific symput statements and %let beeing resolved beforehand. Got it working using the casl symput&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2020 09:46:51 GMT</pubDate>
    <dc:creator>Ullsokk</dc:creator>
    <dc:date>2020-09-15T09:46:51Z</dc:date>
    <item>
      <title>Can't use macro variable in proc CAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683889#M207176</link>
      <description>&lt;P&gt;I am trying to check if the dataset is already loaded to cas using this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let data= 'MyDataSet';

proc cas;
    table.tableExists result =r / name="&amp;amp;data" caslib="MyCasLib";
	print(r);
    if r=0  then do;
		print("table is not loaded");
		%let loaded = 0;
    end;
    else ;
		print("Table already loaded");
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The code works if I hard code the table name, but not if I try to use a macro value, and enter "MyDataSet" in stead. From the log, I can see that the macro variable is not resolved when I try to use the macro variable &amp;amp;data&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683889#M207176</guid>
      <dc:creator>Ullsokk</dc:creator>
      <dc:date>2020-09-15T08:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use macro variable in proc CAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683892#M207178</link>
      <description>&lt;P&gt;Everything after the %LET up to the semicolon (except leading and trailing blanks) is stored in the macro variable, so your statement resolves to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;table.tableExists result =r / name="'MyDataSet'" caslib="MyCasLib";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is not correct syntax. Always keep in mind that the macro processor is a text generating/replacing engine, and you do not need quotes around strings, unless you explicitly want them later (which is usually not the case).&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683892#M207178</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-15T08:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use macro variable in proc CAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683893#M207179</link>
      <description>&lt;P&gt;And your next mistake is this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let loaded = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Macro statements are resolved&amp;nbsp;while the code is fetched for interpretation/compilation, so this statement is resolved before PROC CAS runs, and &amp;amp;loaded will be zero in all cases.&lt;/P&gt;
&lt;P&gt;You have to use the CASL functions SYMPUT or SYMPUTX to conditionally set a macro variable.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683893#M207179</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-15T08:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use macro variable in proc CAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683902#M207187</link>
      <description>&lt;P&gt;Thansks, I did not know about cas spesific symput statements and %let beeing resolved beforehand. Got it working using the casl symput&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 09:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-use-macro-variable-in-proc-CAS/m-p/683902#M207187</guid>
      <dc:creator>Ullsokk</dc:creator>
      <dc:date>2020-09-15T09:46:51Z</dc:date>
    </item>
  </channel>
</rss>

