It seems that TRANSLATE would be a good function to use. However when using %SYSFUNC with this function, the parameters are not surrounded with quotes. How do you indicate a blank should be used as replacement?
...
In my code I have several macros. Macro A is the main macro. Macro A then calls macro B which in turn calls macro C.
In SAS, do I have to define them in backwards order? In other words, do I have to define macro C first, then macro B, then macro A last? Or does it matter since SAS reads all the code in before it actually hits the ...
is there a short way to make ALL macro variables created inside a macro global in scope?
ie:
%macro x;
%global _all_; * ??? ;
%let x=1;
%let y=1;
%let z=1;
%mend;
...
Is it possible to allocate a SAS script or macro to a Toolbar button in Base SAS? ie can you 'dm' a macro or sas script?
...
I have a macro that creates a timestamp (to append to output file names). However, rather than have to remember what macro variable the macro assigns the value to, I would prefer to assign a macro variable to the result of the macro (if that isn't circular enough).
%let tms= %tms();
This is the current macro....
%macro tms ;
%* C...
Ever had a problem with a SAS session, but been unable to close the session due to having critical files in your remote work library (RWORK)??
I certainly have! So how do you access that library from another (new) session?
...
I'm using SAS 9.1.3 to call a macro in a DATA step, but the macro generates a PROC REPORT step, so I am using CALL EXECUTE to call it, generate all those PROC REPORT steps, and then execute them all after the DATA step.
I'm using an array, and the macro is executed each time for every element in this array:
DATA macro_test;
ARRAY que...
I am trying to amend the macro below to accept a macro parameter as the 'location' argument for a dir command. However I cannot get it to resolve correctly due to the nested quotes issue. Using %str(%') does not work, neither do quoting functions for some reason.
The macro will work fine when the filepath has no spaces (eg C:\temp\wit...
I have 169 towns for which I want to iterate a macro. I need the output files to be saved using the town-name (rather than a town-code). I have a dataset (TOWN) with town-code and town-name. Is it possible to have a %let statement that is set to the town-name for each iteration where i=town-code?
I know that I can list out the town-...
In other programming languages such as C++, include guards are used to prevent multiple inclusions of the same code.
Like this in C++:
#ifndef FOO_INCLUDED
#define FOO_INCLUDED
....
#endif
Does it make sense to build inclusion guards into your SAS macro function definitions? And how should it be done?
...
Can anyone provide the syntax for retrieving a SAS Macro from a permanent catalog? (ie copy it into my work.sasmacr location)
I don't need this as part of my autocall as I won't always be connecting to this library...
...
Is it possible to create customised dropdown menus in EG? ie I would like to present a user with a list of dropdowns, and the ability to click a 'submit' button that would use the values of those dropdowns to run a SAS macro...
Also, is this possible without setting up a stored process?
...
I have a program which creates a stored compiled macro in a library using the syntax:
options mstored sasmstore=MyLib;
%macro MyMac() /store source des='My Macro';
%let x=1;
%mend;
However I cannot seem to re-assign my library (MyLib) afterwards - I get the following message (sas 9.1.3):
ERROR: Unable to clear or re-assign the li...
I'm almost embarassed, but I'm struggling to create a regular expression to change something like cat dog mouse to a SQL where clause:
a.cat=b.cat AND a.dog=b.dog AND a.mouse=b.mouse
With
s/(\w*)\s?/a.$1=b.$1 AND /
I get
a.cat=b.cat AND a.dog=b.dog AND a.mouse=b.mouse AND a.=b. AND
Ouch. Help appreciated.
EDIT: I ended up usin...
how to find vintage in risk management with sas macro?
...