BookmarkSubscribeRSS Feed
jesseg
Calcite | Level 5

I'm a frequent user of the lua procedure within SAS and a few times I have stumbled across the sasxx class and its corresponding methods.

 

A common use case is for file assignments within proc lua that look similar to:

 

sasxx.new(fileref)

sasxx.assign(file, fileref)

 

I've scraped the web for documentation on this mysterious sasxx but come up empty, anyone else have more information?

 

Thanks!

4 REPLIES 4
ChrisHemedinger
Community Manager

The best introductions to PROC LUA I'm aware of include this blog post/video with the developer, and this paper that he wrote for SAS Global Forum.

 

If you have questions beyond what these can answer, let us know and we'll try to track down the answers.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
ChrisHemedinger
Community Manager

About the sasxx methods -- I believe that these were undocumented placeholders for some new functions that had been added for library extensions, some of which have been added formally (ex: string functions) -- see the doc for SAS 9.4/SAS Viya 3.5.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
JackHamilton
Lapis Lazuli | Level 10

I'd be very interested in hearing what problems you are using Lua to solve.  Statistical analyses?  Data management?  

 

When proc Lua was first announced, I had great hopes for it, but I was disappointed in those hopes.  It lacks at least three things:

- Access to the OS library (primarily, calling external programs) and to the filesystem (other than through the SAS file functions, and I haven't tried those so I don't know if they work in practice).


- Potentially useful LuaRocks packages such as watcher and luafilesyste.  SAS can't support every possible package out there, but it could support a subset.  SAS has a C-compiler.


- A way to create functions in Lua and call them from SAS (as can be done with Java, proc Groovy,  and reportedly Python).

It also doesn't follow SAS conventions in some ways.  For example, in many places in SAS you can specify an external file using either a quoted name or a fileref, but in proc Lua, infile= is documented as supporting only quoted filenames.
 

BrunoMueller
SAS Super FREQ

Access to the OS library just works fine. Also using the IO library is ok, see sample below. In which version this was introduced, I do not know.


proc lua;
submit;
local ls_return = os.execute("dir c:\\temp > c:\\temp\\sugus.txt")
print(ls_return) 
local f = assert(io.open("c:\\temp\\sugus.txt", "rb"))
local content = f:read("*all") 
f:close()
print(content)
endsubmit;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 1825 views
  • 6 likes
  • 4 in conversation