Published on :
Général CREATION_INTERNE

Sans titre

This code is also available in: Français Deutsch Español
Attention : This code requires administrator privileges.
Data Analysis

Type : CREATION_INTERNE


The macro does not process any datasets. It interacts with the SAS environment by reading and modifying a system option (`SASAUTOS`) via the `%sysfunc(getoption(...))` and `OPTIONS APPEND` functions.

1 Code Block
MACRO
Explanation :
This block defines the `%_insertAutoCallPath` macro. It declares local macro variables, then checks if the input parameter `autocallpath` is empty. It uses `%sysfunc(getoption())` to retrieve the current SASAUTOS value and `%sysfunc(findw())` to search if the path is already there. If the path is not found, it checks with `%sysfunc(fileref())` if the parameter is a fileref. Finally, it uses `OPTIONS APPEND` to add either the fileref or the path (enclosed in quotes) to the SASAUTOS list.
Copied!
1%macro _insertAutoCallPath(autocallpath);
2
3 %local
4 l_currentAutoCallPath
5 l_found
6 l_autoCallPath
7 l_paramIsFileRef
8 ;
9
10 %IF (%LENGTH(&autocallpath.)=0) %THEN %goto exit;
11 
12 %*-- %_issueTraceMessage (&g_currentLogger., Searching for Autocallpath &autocallpath); --*;
13 
14 %let l_currentAutoCallPath=%sysfunc (getoption (SASAUTOS));
15 %let l_found=%sysfunc (findw (&l_currentAutoCallPath., &autocallpath., %str(% %"%(%)), I));
16
17 %if (&l_found. > 0) %then %do;
18 %*-- %_issueDebugMessage (&g_currentLogger., Autocallpath &autocallpath already set.); --*;
19 %end;
20 %else %do;
21 %let l_paramIsFileRef = 0;
22 %if (%length(&autocallpath.) <= 8) %then %do;
23 %let l_paramIsFileRef = %eval(%sysfunc (fileref (&autocallpath.))=0);
24 %end;
25
26 %if (&l_paramIsFileRef.) %then %do;
27 options append=(SASAUTOS=(&autocallpath.));
28 %end;
29 %else %do;
30 options append=(SASAUTOS=("&autocallpath."));
31 %END;
32 %END;
33
34 %exit:
35%mend _insertAutoCallPath;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de. This file is part of SASUnit, the Unit testing framework for SAS(R) programs.