Hey everyone! I'm in bit of a pickle and have spent hours trying to figure this out so hoping someone out there can help. I have a project in SAS EG that contains two programs. Now, I inherited this project so I don't know what went into creating this project. But basically, one of the programs uses a &month and &year macro variable that gets defined in the Project Prompts screen when you run the project. These should be global variables.
In fact, &month is a global variable. When I run both programs, the variable gets initialized correctly.
But for whatever reason, that's not happening with &year. It works in Program A but is not present in Program B.
I put in this code in Program A to see the macro variables:
%put _global_;
The output is:
25 GOPTIONS ACCESSIBLE;
26 %put _global_;
GLOBAL MONTH November
GLOBAL YEAR 2018
But when I put the same code in Program B:
%put _global_;
I only get this:
22 GOPTIONS ACCESSIBLE;
23 %put _global_;
GLOBAL MONTH November
Does anyone know why this is happening?
Just an update to everyone: I discovered that the reason for this was because I didn't have the "Use prompt value throughout project" box selected for that particular prompt/macro variable. Checking that box solved my issue.
Are you executing program A and program B in the same EG session? Are the lines of code before %put _global_; the same?
The line numbers differ in the two logs; this points to different environments.
Just an update to everyone: I discovered that the reason for this was because I didn't have the "Use prompt value throughout project" box selected for that particular prompt/macro variable. Checking that box solved my issue.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.