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

I tried running the following code today:

 

%let mapping_table=work.config;
proc lua restart;
submit "mapping_table=&mapping_table" ;
  print(mapping_table)
endsubmit;
run;

 

Which resulted in:

 

ERROR: SUBMIT block:1: attempt to index global 'work' (a nil value)

Removing the period (.) resolves the issue.

 

Is this a bug?  Or a feature?  

 

SYSVLONG=9.04.01M3P062415

 

 

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
1 ACCEPTED SOLUTION

Accepted Solutions
rhale
Fluorite | Level 6

Try using single quotes around the macro variable in the SUBMIT statement:

 

%let mapping_table=work.config;
proc lua restart;
submit "mapping_table='&mapping_table'" ;
  print(mapping_table)
endsubmit;
run;

 

View solution in original post

4 REPLIES 4
rhale
Fluorite | Level 6

Try using single quotes around the macro variable in the SUBMIT statement:

 

%let mapping_table=work.config;
proc lua restart;
submit "mapping_table='&mapping_table'" ;
  print(mapping_table)
endsubmit;
run;

 

AllanBowe
Barite | Level 11
The bug was in my brain.. Of course, when creating a lua variable, it needs a type - so strings must be quoted (else they will be interpreted as a variable name)
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
sspkmnd
Obsidian | Level 7

Another (more reliable) approach is to use sas.symput function:

 

%let mapping_table=work.config;
proc lua restart;
submit;
  mapping_table = sas.symget('mapping_table')
  print(mapping_table)
endsubmit;
run;
AllanBowe
Barite | Level 11
indeed - this approach will handle nested quotes, and long values, unlike the `submit` approach. Thanks!
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 919 views
  • 4 likes
  • 3 in conversation