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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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