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() .
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.