Hi experts,
Question is for SAS Viya 2022.9
In PROC LUA one could invoke SAS functions directly for example:
proc lua;
submit;
local dsid = sas.open("sashelp.class")
for row in dsid:rows() do
print(row.age, row.height)
end
dsid:close()
endsubmit;
run;
I am struggling to do the same with PROC PYTHON. For example to invoke the "sas.open" function I found only this way which is kind of cumbersome compared to PROC LUA:
dsid = SAS.sasfnc("open","sashelp.class")
And I could not find the equivalent of "dsid:rows()" in PROC PYTHON.
Am I missing something?
For actions specific to working with a data table, I think you would use SAS.sd2df to convert the data set into a pandas data frame, and then use the Python friendly data frame methods.
Otherwise, yes -- I think the way to invoke SAS functions generically from Python is the SAS.sasfnc method -- there isn't a Python-specific wrapper for each SAS function (or even the most commonly used ones).
For actions specific to working with a data table, I think you would use SAS.sd2df to convert the data set into a pandas data frame, and then use the Python friendly data frame methods.
Otherwise, yes -- I think the way to invoke SAS functions generically from Python is the SAS.sasfnc method -- there isn't a Python-specific wrapper for each SAS function (or even the most commonly used ones).
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.