<?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: PROC LUA - Resolving variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/273241#M58428</link>
    <description>&lt;P&gt;Glad you got it working! I had reached out to Paul Tomas, &lt;A href="http://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs/" target="_self"&gt;the SAS developer who works on PROC LUA&lt;/A&gt; -- but he was out these past few days, I think.&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2016 12:50:31 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2016-05-26T12:50:31Z</dc:date>
    <item>
      <title>PROC LUA - Resolving variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/272680#M58377</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm building XML files using EGuide and I've being using Proc Lua to pass the values to the XML, via Lua local variables. Now, I have more than 200 variables, so they cannot be defined as local, due to limitations to LUA itself. I tried a different approach that is defining only one local variable and then defining the other as attributes of this one. Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lua;
submit;
  local dsid = sas.open("sashelp.fish") -- open for input            
  local vars = {}
  local count=0&lt;BR /&gt;
  -- Iterate over the rows of the data set   
  while sas.next(dsid) do
	count = count+1

	local Species
	local fish = {}
        --Working Method &lt;BR /&gt; 	Species = sas.get_value(dsid, "species")

	--Not working method
	fish.species = sas.get_value(dsid, "species")&lt;BR /&gt;
	sas.submit
		[[
		%Put Non-working: Species =  @fish.species@;
		%Put Working: Species = @Species@;
		]]


   end
   sas.close(dsid)
endsubmit;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 10:53:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/272680#M58377</guid>
      <dc:creator>fetcs74</dc:creator>
      <dc:date>2016-05-24T10:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: PROC LUA - Resolving variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/272961#M58416</link>
      <description>&lt;P&gt;After some tests, I was able to find a solution. Instead of declaring each variable as local, I passed them as parameter when calling sas.submit:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lua;
submit;
  local dsid = sas.open("sashelp.fish") -- open for input            
  local vars = {}
  local count=0
  -- Iterate over the rows of the data set   
  while sas.next(dsid) do
	count = count+1

	sas.submit(
		[[
		%Put New working: Species =  @species2@;
		]],{species2=sas.get_value(dsid, "species")})


   end
   sas.close(dsid)
endsubmit;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that LUA is case sensitive!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that this can help someone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 08:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/272961#M58416</guid>
      <dc:creator>fetcs74</dc:creator>
      <dc:date>2016-05-25T08:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC LUA - Resolving variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/273241#M58428</link>
      <description>&lt;P&gt;Glad you got it working! I had reached out to Paul Tomas, &lt;A href="http://blogs.sas.com/content/sasdummy/2015/08/03/using-lua-within-your-sas-programs/" target="_self"&gt;the SAS developer who works on PROC LUA&lt;/A&gt; -- but he was out these past few days, I think.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 12:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-LUA-Resolving-variables/m-p/273241#M58428</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-05-26T12:50:31Z</dc:date>
    </item>
  </channel>
</rss>

