DATA Step, Macro, Functions and more

%include or some other procedure to call macro with conditions

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

%include or some other procedure to call macro with conditions

Hi All,

I finally wrote a piece of macro that runs regressions for all variables and data sets in a library and produces ODS.

My problem is how can i use %include or something similar to call the macro with user specified conditions:

1. The user doesn't need to see the whole code

I beleive this can be done by saying %include 'path' (where path contains the name of the sas file which has the macro reg_adm);

But

2. I also want the user to specify some parameters like Data set names etc. which I have include in %let statements within the macro reg_adm

Struggling on the last leg of the macro

Regards,


Accepted Solutions
Solution
‎11-03-2014 07:02 AM
Super Contributor
Posts: 340

Re: %include or some other procedure to call macro with conditions

I have never tried this, but in principle it is possible to do something similar in SAS Base - but uglier :-) - like with the EG:

39007 - How to create a simple prompt for user input

View solution in original post


All Replies
Super User
Posts: 7,771

Re: %include or some other procedure to call macro with conditions

You should look either at

- an Enterprise Guide project with SAS code (you can dor the %inc there) and user prompts

- a stored process with required parameters. A simple web form is all that is required to call the stored process via /SASStoredProcess on the web application server

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 340

Re: %include or some other procedure to call macro with conditions

If I understood you correctly; 1) include any SAS-code including macros:

Filename MyFile "C:\Users\Username\Desktop\Test.sas";

%Include MyFile;

2) If you would like to user-friendly replace %let-statements, you might be looking for prompts in the enterprise guide (if you#re using one); right-klick on the code in the EG, then "properties", then "prompts".

Contributor
Posts: 22

Re: %include or some other procedure to call macro with conditions

Posted in reply to user24feb

Hi,

Thanks for your reply. Yes you understood correctly that I have used %let statements within the code. I want the user to be able to specify the %let when they run the %include statement

My problem is that my SAS EG is a server based installation and all users don't have a server. They have SAS Base locally installed. Is there a way that I can change the prompt property in SAS base also? (similar to the right click option you have suggested in SAS EG)

Thanks

Solution
‎11-03-2014 07:02 AM
Super Contributor
Posts: 340

Re: %include or some other procedure to call macro with conditions

I have never tried this, but in principle it is possible to do something similar in SAS Base - but uglier :-) - like with the EG:

39007 - How to create a simple prompt for user input

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 266 views
  • 0 likes
  • 3 in conversation