BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nacnudus
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION
1 REPLY 1

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1561 views
  • 1 like
  • 1 in conversation