Hello
I am using SAS 9.4.
I have a program called "regroup" that indicates the location of two sets of text documents plus an export file name as %let export_file:
Libname mylib 'C:\SAS Datasets'; filename M_regrp('C:\text data\monthly\.*txt'; filename Y_regrp('C:\text data\yearly\*.txt'; %let export_file="C:\sas_data.mdb";
I wish to call the regroup from another program and pass the 4 settings above from the other program. How do I do that? Thanks.
Why would you handle something simple as that in an external include? It only obfuscates your code and makes life a misery for your future self.
The report in question (regrp) is actually used for many hospitals and I have them all in the code and just comment out the sites I don't want at the time I run it. So rather than have multiple copies of regrp to call for each site from this other program, I thought it would be easier to call it from another program that I have to run that uses the resulting dataset from the regrp program.
And what about those 4 statements should be parameterized?
Not sure I know what you're asking but each hospital with have a different location for the file location of M_regrp and Y_regrp as well as different locations for the library name and the export_file. So I want to pass those to the report via the other report that calls the program.
Define what the "settings" are in this sentence from your first post:
I wish to call the regroup from another program and pass the 4 settings above from the other program.
So you would do something like
%let libpath=C:\SAS Datasets;
%include 'c:\.......\regroup.sas';
and regroup.sas would be
libname mylib "&libpath.";
I wasn't sure about what you were advising but I found that all I needed to do was to copy the filename, libname and let statement for the database to above the %include line and it runs as it should. Thanks.
If you have SAS/IML, you could try CALL EXECUTEFILE() .
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.