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
MacroCore library for app developers
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
MacroCore library for app developers
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
MacroCore library for app developers
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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