The script does not process external datasets for analysis. It manipulates character strings (macro variables) to determine the execution platform and to construct parameters for code retrieval macro calls. The `DATA _NULL_` step is used for internal transformation of these strings into macro variables for Viya-specific calls.
1 Code Block
Macro
Explanation : This block initializes the `%mx_getcode` macro with the parameters `loc` (code location) and `outref` (output file reference). It then declares the local macro variables `platform`, `name`, and `shortloc`. The `%mf_getplatform` macro is called to detect the current SAS platform, and its result is stored in the `platform` variable.
Copied!
%macro mx_getcode(loc,outref=0
)/*/STORE SOURCE*/;
%local platform name shortloc;
%let platform=%mf_getplatform();
1
%macro mx_getcode(loc,outref=0
2
)/*/STORE SOURCE*/;
3
4
%local platform name shortloc;
5
%let platform=%mf_getplatform();
2 Code Block
Macro Call
Explanation : If the detected platform is `SASJS`, this block is executed. It calls the `%ms_getfile` macro to retrieve the content of the SASjs file specified by the macro variable `loc` (with the `.sas` extension added) and stores it in the `outref` file reference.
Explanation : If the detected platform is `SAS9` or `SASMETA`, this block is executed. It calls the `%mm_getstpcode` macro to retrieve a Stored Process. The path to this Stored Process is provided by the `tree` parameter (the macro variable `loc`), and the retrieved code is stored in the `outref` file reference.
Copied!
%else %if &platform=SAS9 or &platform=SASMETA %then %do;
%mm_getstpcode(tree=&loc,outref=&outref)
%end;
1
%ELSE %IF &platform=SAS9 or &platform=SASMETA %THEN %DO;
2
%mm_getstpcode(tree=&loc,outref=&outref)
3
%END;
4
4 Code Block
DATA STEP & Macro Call Data
Explanation : For the `SASVIYA` environment, this block is activated. A `DATA _NULL_` step is executed to parse the macro variable `loc`. It extracts the last component of `loc` as `name` (the job name) and the rest of the path as `shortloc`. These values are then stored in local macro variables. Finally, the `%mv_getjobcode` macro is called with these `path`, `name`, and `outref` to retrieve the Viya job code.
Copied!
%else %if &platform=SASVIYA %then %do;
/* extract name & path from &loc */
data _null_;
loc=symget('loc');
name=scan(loc,-1,'/');
shortloc=substr(loc,1,length(loc)-length(name)-1);
call symputx('name',name,'l');
call symputx('shortloc',shortloc,'l');
run;
%mv_getjobcode(
path=&shortloc,
name=&name,
outref=&outref
)
%end;
Explanation : If none of the platforms (`SASJS`, `SAS9`/`SASMETA`, `SASVIYA`) are detected, this block is executed. It writes an error message to the SAS log, indicating that the platform identified by `platform` is not supported. The `%mx_getcode` macro then terminates with `%mend`.
Copied!
%else %put &sysmacroname: &platform is unsupported!!!;
%mend mx_getcode;
1
%ELSE %put &sysmacroname: &platform is unsupported!!!;
2
%mend mx_getcode;
3
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 test framework for SAS(R) programs.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.