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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1346 views
  • 4 likes
  • 3 in conversation