BookmarkSubscribeRSS Feed
Suja
Fluorite | Level 6

Hi,

 

I have setup parallel processing in Eguide recently using File -> Project Properties -> Code Submission -> Allow parallel execution on the same server.

My EG project run 'Main' code first and then run the other two codes parallel. 

 

I have setup  country and include_section_personal as a global variables. But one of the code is keep failing with the below error. Can anyone help with this issue? Thanks in advance.

 

WARNING: Apparent symbolic reference INCLUDE_SECTION_PERSONAL not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
&include_section_personal = 1 and &country = AU
WARNING: Apparent symbolic reference COUNTRY not resolved.
ERROR: The macro AU_PERSONAL will stop executing.

 

7 REPLIES 7
Suja
Fluorite | Level 6

I have two sub code which is running parallel after Main code. One of the code is working fine with these macro variable.

 

Main code:

/* Global variable */
%global country application_date  include_section_personal;

%let country = AU;

%let include_section_personal = 1;

 

Sub code (Personal):

%macro read_personal;
%if &include_section_personal = 1 and &country = AU %then %do;
data personal_attribute;

set pss.personal_attribute;

 

 

Patrick
Opal | Level 21

@Suja

I didn't know that EG allows for parallel processing. What this must mean technically though: Each parallel process runs in its own workspace session/its own environment. Everything specific to a Workspace session won't be available to another Workspace session (i.e. work tables, macro variables and the like). 

For this reason a macro variable defined in the one session (code) won't be available in the other session.

 

Suja
Fluorite | Level 6

Thanks KurtBremser for your solution. I'm using sashelp.vmacro to save the global variable to permenant library and assigning back the global variable in the submodule code. The below solutions is working fine.

 

 

Main Module:

 

/* Global variables */
%global country application_date include_section_personal ;

%let country = AU;
%let application_date = today()-60;

 

libname append "F:\SAS Data";

%PUT _GLOBAL_;

/* Save Globale variables into Append library */
data Append.vars;
set sashelp.vmacro(where=(scope='GLOBAL'));
run;

 

Submodule (Personal):

libname append "F:\SAS Data";

/* Place the macro variable(s) back into the GLOBAL symbol table from Append library */
data _null_;
set append.vars(where=(scope='GLOBAL'));
if substr(name,1,3) ne 'SYS' then do;
call execute('%global '||strip(name)||';');
call execute('%let '||strip(name)||'='||strip(value)||';');
end;
run;

 

Thanks for all your help!

ballardw
Super User

@Suja wrote:

Hi,

 

I have setup parallel processing in Eguide recently using File -> Project Properties -> Code Submission -> Allow parallel execution on the same server.

My EG project run 'Main' code first and then run the other two codes parallel. 

 

I have setup  country and include_section_personal as a global variables. But one of the code is keep failing with the below error. Can anyone help with this issue? Thanks in advance.

 

WARNING: Apparent symbolic reference INCLUDE_SECTION_PERSONAL not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
&include_section_personal = 1 and &country = AU
WARNING: Apparent symbolic reference COUNTRY not resolved.
ERROR: The macro AU_PERSONAL will stop executing.

 


The highlighted text usually indicates a value was not assigned to the macro variable. It may indicate that the macro variable that had the value assigned was spelled differently or that the code to assign it has not been run when encountered.

The error is because that variable was blank. The other warnings indicate that you may have a recurring assignment problem as &country was not assigned either.

 

This sequence of errors makes me suspect that you may have been attempting to reference data set variable values with macro variable names. That doesn't work.

Post the code for the macro AU_PERSONAL and the code that called the macro in a code box opened using the forum's {I} icon.

Kurt_Bremser
Super User

Macro variables are local to a single SAS instance. As soon as you use parallel execution, only the one node running on the instance where the macro variable was created will work, all others will fail.

You need to find another method to propagate your metadata into the nodes.

Example:

Code1:

data _null_;
cutoff = 15;
call symputx('cutoff',put(cutoff,best.));
run;

Code2:

data _null_;
cutoff = 15;
call symputx('cutoff',put(cutoff,best.));
run;

Code3:

data after;
set sashelp.class;
where age ge &cutoff;
run;

Parallel execution is enabled for the project, code2 and code3 are connected to code1.

When the process flow is executed, code2 fails (symbolic reference not resolved), while code3 works.

This works:

Code1:

data sasuser.tempvar;
name = 'cutoff';
value = '15';
run;

Code2:

data _null_;
set sasuser.tempvar;
call symputx(name,value);
run;

data before;
set sashelp.class;
where age < &cutoff;
run;

Code3:

data _null_;
set sasuser.tempvar;
call symputx(name,value);
run;

data after;
set sashelp.class;
where age ge &cutoff;
run;

Use any permanent library where you have write permission.

Suja
Fluorite | Level 6

Thanks KurtBremser for your solution. I'm using sashelp.vmacro to save the global variable to permenant library and assigning back the global variable in the submodule code. The below solutions is working fine.

 

 

Main Module:

 

/* Global variables */
%global country application_date include_section_personal ;

%let country = AU;
%let application_date = today()-60;

 

libname append "F:\SAS Data";

%PUT _GLOBAL_;

/* Save Globale variables into Append library */
data Append.vars;
set sashelp.vmacro(where=(scope='GLOBAL'));
run;

 

Submodule (Personal):

libname append "F:\SAS Data";

/* Place the macro variable(s) back into the GLOBAL symbol table from Append library */
data _null_;
set append.vars(where=(scope='GLOBAL'));
if substr(name,1,3) ne 'SYS' then do;
call execute('%global '||strip(name)||';');
call execute('%let '||strip(name)||'='||strip(value)||';');
end;
run;

 

Thanks for all your help!

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 2521 views
  • 0 likes
  • 5 in conversation