mirror of
https://github.com/sasjs/core.git
synced 2026-01-09 10:20:06 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c030174bfb | ||
|
|
faf466e79a | ||
|
|
856ffc1b72 | ||
|
|
c0924af06b | ||
|
|
33cec61a13 | ||
|
|
854ff696d8 | ||
|
|
cc3435d13d | ||
|
|
5ceaac195d | ||
|
|
5d5df977a6 | ||
|
|
245e85ef36 | ||
|
|
b96df6f14f |
56
all.sas
56
all.sas
@@ -1066,7 +1066,8 @@ or %index(&pgm,/tests/testteardown)
|
|||||||
%else %if %symexist(&metavar) %then %do;
|
%else %if %symexist(&metavar) %then %do;
|
||||||
%if %length(&&&metavar)=0 %then %let user=&sysuserid;
|
%if %length(&&&metavar)=0 %then %let user=&sysuserid;
|
||||||
/* sometimes SAS will add @domain extension - remove for consistency */
|
/* sometimes SAS will add @domain extension - remove for consistency */
|
||||||
%else %let user=%scan(&&&metavar,1,@);
|
/* but be sure to quote in case of usernames with commas */
|
||||||
|
%else %let user=%unquote(%scan(%quote(&&&metavar),1,@));
|
||||||
%end;
|
%end;
|
||||||
%else %let user=&sysuserid;
|
%else %let user=&sysuserid;
|
||||||
|
|
||||||
@@ -7937,7 +7938,7 @@ run;
|
|||||||
@param [in] salt= Provide a salt (could be, for instance, the dataset name)
|
@param [in] salt= Provide a salt (could be, for instance, the dataset name)
|
||||||
@param [in] iftrue= A condition under which the macro should be executed.
|
@param [in] iftrue= A condition under which the macro should be executed.
|
||||||
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This
|
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This
|
||||||
will contain one column (hashkey) with one observation (a hex32.
|
will contain one column (hashkey) with one observation (a $hex32.
|
||||||
representation of the input hash)
|
representation of the input hash)
|
||||||
|hashkey:$32.|
|
|hashkey:$32.|
|
||||||
|---|
|
|---|
|
||||||
@@ -8640,13 +8641,13 @@ select distinct lowcase(memname)
|
|||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
@li mp_cntlout.sas
|
@li mp_cntlout.sas
|
||||||
@li mp_lockanytable.sas
|
@li mp_lockanytable.sas
|
||||||
|
@li mp_storediffs.sas
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Macros </h4>
|
||||||
@li mddl_dc_difftable.sas
|
@li mddl_dc_difftable.sas
|
||||||
@li mddl_dc_locktable.sas
|
@li mddl_dc_locktable.sas
|
||||||
@li mp_loadformat.test.sas
|
@li mp_loadformat.test.sas
|
||||||
@li mp_lockanytable.sas
|
@li mp_lockanytable.sas
|
||||||
@li mp_storediffs.sas
|
|
||||||
@li mp_stackdiffs.sas
|
@li mp_stackdiffs.sas
|
||||||
|
|
||||||
|
|
||||||
@@ -8872,6 +8873,9 @@ options ibufsize=&ibufsize;
|
|||||||
,mdebug=&mdebug
|
,mdebug=&mdebug
|
||||||
)
|
)
|
||||||
|
|
||||||
|
proc append base=&auditlibds data=&storediffs;
|
||||||
|
run;
|
||||||
|
|
||||||
%if &locklibds ne 0 %then %do;
|
%if &locklibds ne 0 %then %do;
|
||||||
%mp_lockanytable(UNLOCK
|
%mp_lockanytable(UNLOCK
|
||||||
,lib=%scan(&auditlibds,1,.)
|
,lib=%scan(&auditlibds,1,.)
|
||||||
@@ -8895,7 +8899,8 @@ options ibufsize=&ibufsize;
|
|||||||
%put &sysmacroname exit vars:;
|
%put &sysmacroname exit vars:;
|
||||||
%put _local_;
|
%put _local_;
|
||||||
%end;
|
%end;
|
||||||
%mend mp_loadformat;/**
|
%mend mp_loadformat;
|
||||||
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Mechanism for locking tables to prevent parallel modifications
|
@brief Mechanism for locking tables to prevent parallel modifications
|
||||||
@details Uses a control table to enable ANY table to be locked for updates
|
@details Uses a control table to enable ANY table to be locked for updates
|
||||||
@@ -9401,7 +9406,7 @@ put(md5(
|
|||||||
&sep put(md5(trim(put(ifn(missing(&var),&var,&var*1),binary64.))),$hex32.)
|
&sep put(md5(trim(put(ifn(missing(&var),&var,&var*1),binary64.))),$hex32.)
|
||||||
%let sep=!!;
|
%let sep=!!;
|
||||||
%end;
|
%end;
|
||||||
),hex32.)
|
),$hex32.)
|
||||||
%mend mp_md5;
|
%mend mp_md5;
|
||||||
/**
|
/**
|
||||||
@file
|
@file
|
||||||
@@ -9693,7 +9698,7 @@ filename &inref &infile lrecl=1 recfm=n;
|
|||||||
|
|
||||||
data &ds1;
|
data &ds1;
|
||||||
infile &inref;
|
infile &inref;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
@@ -15086,7 +15091,8 @@ data _null_;
|
|||||||
put ' %else %if %symexist(&metavar) %then %do; ';
|
put ' %else %if %symexist(&metavar) %then %do; ';
|
||||||
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
||||||
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
||||||
put ' %else %let user=%scan(&&&metavar,1,@); ';
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
||||||
|
put ' %else %let user=%unquote(%scan(%quote(&&&metavar),1,@)); ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put ' %else %let user=&sysuserid; ';
|
put ' %else %let user=&sysuserid; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
@@ -15307,6 +15313,7 @@ filename &fname2 clear;
|
|||||||
%local isgone;
|
%local isgone;
|
||||||
data _null_;
|
data _null_;
|
||||||
length type uri $256;
|
length type uri $256;
|
||||||
|
call missing (of _all_);
|
||||||
rc=metadata_resolve("omsobj:SASLibrary?@Id='&liburi'",type,uri);
|
rc=metadata_resolve("omsobj:SASLibrary?@Id='&liburi'",type,uri);
|
||||||
call symputx('isgone',type,'l');
|
call symputx('isgone',type,'l');
|
||||||
run;
|
run;
|
||||||
@@ -20536,7 +20543,8 @@ data _null_;
|
|||||||
put ' %else %if %symexist(&metavar) %then %do; ';
|
put ' %else %if %symexist(&metavar) %then %do; ';
|
||||||
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
||||||
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
||||||
put ' %else %let user=%scan(&&&metavar,1,@); ';
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
||||||
|
put ' %else %let user=%unquote(%scan(%quote(&&&metavar),1,@)); ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put ' %else %let user=&sysuserid; ';
|
put ' %else %let user=&sysuserid; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
@@ -21527,7 +21535,7 @@ filename &fname1 clear;
|
|||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
,outds=work.viyagroups
|
,outds=work.viyagroups
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer base_uri fname1 libref1;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
||||||
%else %let grant_type=sas_services;
|
%else %let grant_type=sas_services;
|
||||||
@@ -21545,11 +21553,10 @@ filename &fname1 clear;
|
|||||||
)
|
)
|
||||||
|
|
||||||
options noquotelenmax;
|
options noquotelenmax;
|
||||||
%local base_uri; /* location of rest apis */
|
/* location of rest apis */
|
||||||
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
||||||
|
|
||||||
/* fetching folder details for provided path */
|
/* fetching folder details for provided path */
|
||||||
%local fname1;
|
|
||||||
%let fname1=%mf_getuniquefileref();
|
%let fname1=%mf_getuniquefileref();
|
||||||
%let libref1=%mf_getuniquelibref();
|
%let libref1=%mf_getuniquelibref();
|
||||||
|
|
||||||
@@ -21573,12 +21580,12 @@ data &outds;
|
|||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* clear refs */
|
/* clear refs */
|
||||||
filename &fname1 clear;
|
filename &fname1 clear;
|
||||||
libname &libref1 clear;
|
libname &libref1 clear;
|
||||||
|
|
||||||
%mend mv_getgroups;/**
|
%mend mv_getgroups;
|
||||||
|
/**
|
||||||
@file
|
@file
|
||||||
@brief Extract the source code from a SAS Viya Job
|
@brief Extract the source code from a SAS Viya Job
|
||||||
@details Extracts the SAS code from a Job into a fileref or physical file.
|
@details Extracts the SAS code from a Job into a fileref or physical file.
|
||||||
@@ -21625,7 +21632,7 @@ libname &libref1 clear;
|
|||||||
);
|
);
|
||||||
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
%put &sysmacroname entry vars:;
|
%put &sysmacroname local entry vars:;
|
||||||
%put _local_;
|
%put _local_;
|
||||||
%end;
|
%end;
|
||||||
%else %let dbg=*;
|
%else %let dbg=*;
|
||||||
@@ -21692,14 +21699,21 @@ proc http method='GET' out=&fname1 &oauth_bearer
|
|||||||
%end;
|
%end;
|
||||||
;
|
;
|
||||||
run;
|
run;
|
||||||
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
|
||||||
%do;
|
%if &mdebug=1 %then %do;
|
||||||
data _null_;infile &fname1;input;putlog _infile_;run;
|
data _null_;
|
||||||
%mp_abort(mac=&sysmacroname
|
infile &fname1;
|
||||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
input;
|
||||||
)
|
putlog _infile_;
|
||||||
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
%mp_abort(
|
||||||
|
iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
|
||||||
|
,mac=&sysmacroname
|
||||||
|
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||||
|
)
|
||||||
|
|
||||||
%let fname2=%mf_getuniquefileref();
|
%let fname2=%mf_getuniquefileref();
|
||||||
filename &fname2 temp ;
|
filename &fname2 temp ;
|
||||||
|
|
||||||
@@ -21708,7 +21722,7 @@ filename &fname2 temp ;
|
|||||||
data _null_;
|
data _null_;
|
||||||
file &fname2 recfm=n;
|
file &fname2 recfm=n;
|
||||||
infile &fname1 lrecl=1 recfm=n;
|
infile &fname1 lrecl=1 recfm=n;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
retain startwrite 0;
|
retain startwrite 0;
|
||||||
if startwrite=0 and sourcechar='"' then do;
|
if startwrite=0 and sourcechar='"' then do;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
%else %if %symexist(&metavar) %then %do;
|
%else %if %symexist(&metavar) %then %do;
|
||||||
%if %length(&&&metavar)=0 %then %let user=&sysuserid;
|
%if %length(&&&metavar)=0 %then %let user=&sysuserid;
|
||||||
/* sometimes SAS will add @domain extension - remove for consistency */
|
/* sometimes SAS will add @domain extension - remove for consistency */
|
||||||
%else %let user=%scan(&&&metavar,1,@);
|
/* but be sure to quote in case of usernames with commas */
|
||||||
|
%else %let user=%unquote(%scan(%quote(&&&metavar),1,@));
|
||||||
%end;
|
%end;
|
||||||
%else %let user=&sysuserid;
|
%else %let user=&sysuserid;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
@param [in] salt= Provide a salt (could be, for instance, the dataset name)
|
@param [in] salt= Provide a salt (could be, for instance, the dataset name)
|
||||||
@param [in] iftrue= A condition under which the macro should be executed.
|
@param [in] iftrue= A condition under which the macro should be executed.
|
||||||
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This
|
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This
|
||||||
will contain one column (hashkey) with one observation (a hex32.
|
will contain one column (hashkey) with one observation (a $hex32.
|
||||||
representation of the input hash)
|
representation of the input hash)
|
||||||
|hashkey:$32.|
|
|hashkey:$32.|
|
||||||
|---|
|
|---|
|
||||||
|
|||||||
@@ -40,13 +40,13 @@
|
|||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
@li mp_cntlout.sas
|
@li mp_cntlout.sas
|
||||||
@li mp_lockanytable.sas
|
@li mp_lockanytable.sas
|
||||||
|
@li mp_storediffs.sas
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Macros </h4>
|
||||||
@li mddl_dc_difftable.sas
|
@li mddl_dc_difftable.sas
|
||||||
@li mddl_dc_locktable.sas
|
@li mddl_dc_locktable.sas
|
||||||
@li mp_loadformat.test.sas
|
@li mp_loadformat.test.sas
|
||||||
@li mp_lockanytable.sas
|
@li mp_lockanytable.sas
|
||||||
@li mp_storediffs.sas
|
|
||||||
@li mp_stackdiffs.sas
|
@li mp_stackdiffs.sas
|
||||||
|
|
||||||
|
|
||||||
@@ -272,6 +272,9 @@ options ibufsize=&ibufsize;
|
|||||||
,mdebug=&mdebug
|
,mdebug=&mdebug
|
||||||
)
|
)
|
||||||
|
|
||||||
|
proc append base=&auditlibds data=&storediffs;
|
||||||
|
run;
|
||||||
|
|
||||||
%if &locklibds ne 0 %then %do;
|
%if &locklibds ne 0 %then %do;
|
||||||
%mp_lockanytable(UNLOCK
|
%mp_lockanytable(UNLOCK
|
||||||
,lib=%scan(&auditlibds,1,.)
|
,lib=%scan(&auditlibds,1,.)
|
||||||
@@ -295,4 +298,4 @@ options ibufsize=&ibufsize;
|
|||||||
%put &sysmacroname exit vars:;
|
%put &sysmacroname exit vars:;
|
||||||
%put _local_;
|
%put _local_;
|
||||||
%end;
|
%end;
|
||||||
%mend mp_loadformat;
|
%mend mp_loadformat;
|
||||||
|
|||||||
@@ -54,5 +54,5 @@ put(md5(
|
|||||||
&sep put(md5(trim(put(ifn(missing(&var),&var,&var*1),binary64.))),$hex32.)
|
&sep put(md5(trim(put(ifn(missing(&var),&var,&var*1),binary64.))),$hex32.)
|
||||||
%let sep=!!;
|
%let sep=!!;
|
||||||
%end;
|
%end;
|
||||||
),hex32.)
|
),$hex32.)
|
||||||
%mend mp_md5;
|
%mend mp_md5;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ filename &inref &infile lrecl=1 recfm=n;
|
|||||||
|
|
||||||
data &ds1;
|
data &ds1;
|
||||||
infile &inref;
|
infile &inref;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
|
|||||||
@@ -453,7 +453,8 @@ data _null_;
|
|||||||
put ' %else %if %symexist(&metavar) %then %do; ';
|
put ' %else %if %symexist(&metavar) %then %do; ';
|
||||||
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
||||||
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
||||||
put ' %else %let user=%scan(&&&metavar,1,@); ';
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
||||||
|
put ' %else %let user=%unquote(%scan(%quote(&&&metavar),1,@)); ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put ' %else %let user=&sysuserid; ';
|
put ' %else %let user=&sysuserid; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ filename &fname2 clear;
|
|||||||
%local isgone;
|
%local isgone;
|
||||||
data _null_;
|
data _null_;
|
||||||
length type uri $256;
|
length type uri $256;
|
||||||
|
call missing (of _all_);
|
||||||
rc=metadata_resolve("omsobj:SASLibrary?@Id='&liburi'",type,uri);
|
rc=metadata_resolve("omsobj:SASLibrary?@Id='&liburi'",type,uri);
|
||||||
call symputx('isgone',type,'l');
|
call symputx('isgone',type,'l');
|
||||||
run;
|
run;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
@brief Testing mp_loadformat.sas macro
|
@brief Testing mp_loadformat.sas macro
|
||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
|
@li mddl_dc_difftable.sas
|
||||||
@li mp_loadformat.sas
|
@li mp_loadformat.sas
|
||||||
@li mp_assert.sas
|
@li mp_assert.sas
|
||||||
@li mp_assertscope.sas
|
@li mp_assertscope.sas
|
||||||
@@ -12,6 +13,8 @@
|
|||||||
/* prep format catalog */
|
/* prep format catalog */
|
||||||
libname perm (work);
|
libname perm (work);
|
||||||
|
|
||||||
|
%mddl_dc_difftable(libds=perm.audit)
|
||||||
|
|
||||||
data work.loadfmts;
|
data work.loadfmts;
|
||||||
length fmtname $32;
|
length fmtname $32;
|
||||||
eexcl='Y';
|
eexcl='Y';
|
||||||
@@ -49,7 +52,7 @@ run;
|
|||||||
%mp_loadformat(perm.testcat
|
%mp_loadformat(perm.testcat
|
||||||
,work.stagedata
|
,work.stagedata
|
||||||
,loadtarget=YES
|
,loadtarget=YES
|
||||||
,auditlibds=0
|
,auditlibds=perm.audit
|
||||||
,locklibds=0
|
,locklibds=0
|
||||||
,delete_col=deleteme
|
,delete_col=deleteme
|
||||||
,outds_add=add_test1
|
,outds_add=add_test1
|
||||||
@@ -73,4 +76,9 @@ run;
|
|||||||
iftrue=(%mf_nobs(mod_test1)=100),
|
iftrue=(%mf_nobs(mod_test1)=100),
|
||||||
desc=Test 1 - mod obs,
|
desc=Test 1 - mod obs,
|
||||||
outds=work.test_results
|
outds=work.test_results
|
||||||
)
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=(%mf_nobs(perm.audit)=7329),
|
||||||
|
desc=Test 1 - audit table updated,
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|||||||
@@ -63,3 +63,33 @@ run;
|
|||||||
desc=Checking second replace 3rd row,
|
desc=Checking second replace 3rd row,
|
||||||
outds=work.test_results
|
outds=work.test_results
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
%let test3="&sasjswork/file3.txt";
|
||||||
|
%let str=%str(replace.string.with.dots );
|
||||||
|
%let rep=%str( more.dots);
|
||||||
|
data _null_;
|
||||||
|
file &test3;
|
||||||
|
put 'blahblah';
|
||||||
|
put "blahblah&str.blah&str. replace &str.X";
|
||||||
|
put "blahbreplacewith&str.spacesahblah";
|
||||||
|
run;
|
||||||
|
%mp_replace(&test3, findvar=str, replacevar=rep)
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
infile &test3;
|
||||||
|
input;
|
||||||
|
if _n_=2 then call symputx('test3resulta',_infile_);
|
||||||
|
if _n_=3 then call symputx('test3resultb',_infile_);
|
||||||
|
run;
|
||||||
|
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=("&test3resulta" = "blahblah&rep.blah&rep. replace &rep.X"),
|
||||||
|
desc=Checking third replace 2nd row (dots),
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
%mp_assert(
|
||||||
|
iftrue=("&test3resultb" = "blahbreplacewith&rep.spacesahblah"),
|
||||||
|
desc=Checking third replace 3rd row (dots),
|
||||||
|
outds=work.test_results
|
||||||
|
)
|
||||||
|
|||||||
@@ -655,7 +655,8 @@ data _null_;
|
|||||||
put ' %else %if %symexist(&metavar) %then %do; ';
|
put ' %else %if %symexist(&metavar) %then %do; ';
|
||||||
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
put ' %if %length(&&&metavar)=0 %then %let user=&sysuserid; ';
|
||||||
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
put ' /* sometimes SAS will add @domain extension - remove for consistency */ ';
|
||||||
put ' %else %let user=%scan(&&&metavar,1,@); ';
|
put ' /* but be sure to quote in case of usernames with commas */ ';
|
||||||
|
put ' %else %let user=%unquote(%scan(%quote(&&&metavar),1,@)); ';
|
||||||
put ' %end; ';
|
put ' %end; ';
|
||||||
put ' %else %let user=&sysuserid; ';
|
put ' %else %let user=&sysuserid; ';
|
||||||
put ' ';
|
put ' ';
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
,outds=work.viyagroups
|
,outds=work.viyagroups
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer base_uri fname1 libref1;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
||||||
%else %let grant_type=sas_services;
|
%else %let grant_type=sas_services;
|
||||||
@@ -50,11 +50,10 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
options noquotelenmax;
|
options noquotelenmax;
|
||||||
%local base_uri; /* location of rest apis */
|
/* location of rest apis */
|
||||||
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
||||||
|
|
||||||
/* fetching folder details for provided path */
|
/* fetching folder details for provided path */
|
||||||
%local fname1;
|
|
||||||
%let fname1=%mf_getuniquefileref();
|
%let fname1=%mf_getuniquefileref();
|
||||||
%let libref1=%mf_getuniquelibref();
|
%let libref1=%mf_getuniquelibref();
|
||||||
|
|
||||||
@@ -78,9 +77,8 @@ data &outds;
|
|||||||
run;
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* clear refs */
|
/* clear refs */
|
||||||
filename &fname1 clear;
|
filename &fname1 clear;
|
||||||
libname &libref1 clear;
|
libname &libref1 clear;
|
||||||
|
|
||||||
%mend mv_getgroups;
|
%mend mv_getgroups;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
);
|
);
|
||||||
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
%local dbg bufsize varcnt fname1 fname2 errmsg;
|
||||||
%if &mdebug=1 %then %do;
|
%if &mdebug=1 %then %do;
|
||||||
%put &sysmacroname entry vars:;
|
%put &sysmacroname local entry vars:;
|
||||||
%put _local_;
|
%put _local_;
|
||||||
%end;
|
%end;
|
||||||
%else %let dbg=*;
|
%else %let dbg=*;
|
||||||
@@ -112,14 +112,21 @@ proc http method='GET' out=&fname1 &oauth_bearer
|
|||||||
%end;
|
%end;
|
||||||
;
|
;
|
||||||
run;
|
run;
|
||||||
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
|
||||||
%do;
|
%if &mdebug=1 %then %do;
|
||||||
data _null_;infile &fname1;input;putlog _infile_;run;
|
data _null_;
|
||||||
%mp_abort(mac=&sysmacroname
|
infile &fname1;
|
||||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
input;
|
||||||
)
|
putlog _infile_;
|
||||||
|
run;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
|
%mp_abort(
|
||||||
|
iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
|
||||||
|
,mac=&sysmacroname
|
||||||
|
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||||
|
)
|
||||||
|
|
||||||
%let fname2=%mf_getuniquefileref();
|
%let fname2=%mf_getuniquefileref();
|
||||||
filename &fname2 temp ;
|
filename &fname2 temp ;
|
||||||
|
|
||||||
@@ -128,7 +135,7 @@ filename &fname2 temp ;
|
|||||||
data _null_;
|
data _null_;
|
||||||
file &fname2 recfm=n;
|
file &fname2 recfm=n;
|
||||||
infile &fname1 lrecl=1 recfm=n;
|
infile &fname1 lrecl=1 recfm=n;
|
||||||
input sourcechar $ 1. @@;
|
input sourcechar $char1. @@;
|
||||||
format sourcechar hex2.;
|
format sourcechar hex2.;
|
||||||
retain startwrite 0;
|
retain startwrite 0;
|
||||||
if startwrite=0 and sourcechar='"' then do;
|
if startwrite=0 and sourcechar='"' then do;
|
||||||
|
|||||||
Reference in New Issue
Block a user