Set a SAS macro variable (using a %LET statement) and use that macro variable in your included program. You may also need/want to use a %GLOBAL statement from within your included program, if it does not always expect the macro variable to be set to some non-blank value.
Suggested Google advanced search argument, this topic / post:
> I wanted to know if we could pass parameters to the
> SAS program which we use in %include statement using
> the sysparm option.
> If so.. Could you please tell me how do we do it?
> Thanks in advance.
is loaded as SAS starts
On win and unix platforms (but not on z/OS, iirc ) you can establish additional parameters in the invocation line
"path/sas.exe" -sysin your.prog.sas -set extra "additional_code.sas" -sysparm "what ever"
within your main program (named your.prog.sas above) you would add
%include !extra /source2 ;
then program "additional_code.sas" would be included.
Of course you could add it to the sysparm string, but then you will need to parse it out of that string if you use the sysparm for any other purpose.
When running on zOS you would need to provide the value in sysparm as sas is invoked. Your local methods for starting sas on z/OS may (normall) be different, so ask other sas programmers or an administrator.
Once SAS has started &sysparm is like any other macro variable, so expect to use %substr() or %scan() to extract the program name, into macro variable (for example) extra. Then just
%include "&extra" /source2 ;
If the additional program is the only thing in sysparm, then no scan or substr is needed, just
%include "&sysparm" /source2 ;
I'm recommending the /source2 option for the %include because it not only shows the lines of code included, but also shows the full external path and file name, which I find reassuring!