I'm running the following code on SAS 9.4 (also tested on SAS On Demand), taken from page 8 of "Driving SAS with Lua" http://support.sas.com/resources/papers/proceedings15/SAS1561-2015.pdf.
proc lua;
submit;
local dsid = sas.open("sashelp.class")
while sas.next(dsid) do
print(sas.get(dsid,"name"), sas.get(dsid,"age"))
end
sas.close(dsid)
endsubmit;
run;
It fails. The log is:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 proc lua;
57 submit;
58 local dsid = sas.open("sashelp.class")
59 while sas.next(dsid) do
60 print(sas.get(dsid,"name"), sas.get(dsid,"age"))
61 end
62 sas.close(dsid)
63 endsubmit;
64 run;
NOTE: Resuming Lua state from previous PROC LUA invocation.
ERROR: Can't find FCMP or SAS function get
ERROR: SUBMIT block:3: function get not found
stack traceback:
[C]: in function '__index'
SUBMIT block:3: in main chunk
ERROR: There was an error submitting the provided code
WARNING: Closing SASHELP.CLASS - handle has gone out of scope.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE LUA used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
65
66 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
78
Previous code examples work, but any example that uses sas.get does not work.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.