SAS Life Science Analytics Framework and the clinical data products from SAS

How do I use an automatic password macro variable within a user defined macro in the PE?

Reply
SAS Employee
Posts: 11

How do I use an automatic password macro variable within a user defined macro in the PE?

I would like to use a webdav libname statement with &_SDDPW_ within a user defined macro.    How can I do this?

  1. You can use SDD automatic macro variables in the Process Editor such as &_SDDPW_, in a WebDAV libname statement.  If you wouldlike to be able to use the automatic macro variables within other macros, the macro name need to be added to the SDD registry through a change request.   The following macros are in the SDD registry by default and therefore allow the use of the automatic macro variable:  setstart and setaccess. NOTE:  In release SDD 3.5_05 and above, %sasdrugdev_login is also added automatically to
    the registry. 

2.     Here is the code confirming that %setstart is in the registry.  Since the macros setstart and setaccess are in the registry by default, so you can test with the following code. (The
         program assumes that the top level directory is "SDD".)

*Code confirming %setstart is in registry;

%macro setstart;

data _null_;

   call symput('_sddremote_',strip(tranwrd("&_sdddav_",'/webdav','/sddremote')));   

              run;

%sasdrugdev_login(url=&_sddremote_,sdduserid=&_sddusr_, sddpassword=&_sddpw_);

/* List the contents of the root folder in SDD */

%sasdrugdev_getobjects(sddpath=/SDD/);

proc print;

title "List of Objects in /SDD/";

run;

%sasdrugdev_logout;

%mend setstart;

%setstart;

3.  The customer can submit a Change Request to make changes to the SDD Registry to allow certain designated macros, such as  %sasdrugdev_login, to resolve automatic macro  variables.  As noted above, in release SDD 3.5_05 and above, %sasdrugdev_login is also added automatically to the registry. 

       %sasdrugdev_login(URL=https://xxxxxx.sas.com/sddremote, sdduserid=&_SDDUSR_, sddpassword=&_SDDPW_);    

         Here is the code confirming that %sasdrugdev_login is in the registry:

*Code confirming %sasdrugdev_login is in registry;

options nomacrogen nosymbolgen nomlogic nomprint;

data _null_;

   call symput('_sddremote_',strip(tranwrd("&_sdddav_",'/webdav','/sddremote')));   

                      run;

%sasdrugdev_login(url=&_sddremote_,         
sdduserid=&_sddusr_, sddpassword=&_sddpw_);

/* List the contents of the root folder in SDD */

%sasdrugdev_getobjects(sddpath=/SDD/);

proc print;

              title "List of Objects in /SDD/";

run;

%sasdrugdev_logout;

4.  Note:  The outermost macro that contains the  &_SDDPW_  macro must be added to the registry for it to resolve correctly.  For example, if you request that define_libname macro is added to the registry, then it must be used as the outmost macro.   In the example below, any macro within define_libname will work as long as the outermost macro is in the registry.


%macro define_libname;

%macro mymacro;

libname sdd base "&_sdddav_/SDD" webdav
user="&_sddusr_" password="&_sddpw_";

%mend;

%mymacro;

%mend;

%define_libname;



%macro define_libname; /*any code with define_libname will work since it's in
the registry*/

....

%mend;

%define_libname;

        Note:  The value of  &_SDDPW_ can never be displayed as this would allow a program to reveal a password. 

Ask a Question
Discussion stats
  • 0 replies
  • 352 views
  • 0 likes
  • 1 in conversation