Files
dc/sas/sasjs/services/public/getcolvals.test.1.sas
T
dc ee5d7c678e
Build / Build-and-ng-test (pull_request) Successful in 5m25s
Lighthouse Checks / lighthouse (pull_request) Successful in 20m43s
Build / Build-and-test-development (pull_request) Successful in 31m50s
refactor(derived): VAR_DEPS instead of VAR_DEPENDENCIES
Shorter column name, same meaning: every input the expression uses,
physical columns and derived variables alike.
2026-10-20 18:33:24 +00:00

91 lines
1.8 KiB
SAS

/**
@file
@brief testing getcolvals service
<h4> SAS Macros </h4>
@li mp_assertcolvals.sas
@li mp_assertdsobs.sas
@li mx_execute.sas
@li mf_getuniquefileref.sas
**/
%let _program=&appLoc/services/public/getcolvals;
%let f3=%mf_getuniquefileref();
data _null_;
file &f3 termstr=crlf;
put 'LIBDS:$43. COL:$32.';
put "&dclib..MPE_X_TEST,SOME_TIME";
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f3:iwant,
outlib=web3
)
data work.vals;
set web3.vals;
putlog (_all_)(=);
run;
data work.check;
val=1;output;
val=2;output;
run;
%mp_assertcolvals(work.vals.unformatted,
checkvals=work.check.val,
desc=DCLIB found in unfiltered getgolvals response,
test=ANYVAL
)
/**
* derived variable
*/
proc sql;
delete from &dc_libref..mpe_derived
where upcase(libref)="%scan(&dclib..MPE_X_TEST,1,.)"
and upcase(dsn)="%scan(&dclib..MPE_X_TEST,2,.)";
insert into &dc_libref..mpe_derived set
tx_from=0
,tx_to='31DEC5999:23:59:59'dt
,libref="%scan(&dclib..MPE_X_TEST,1,.)"
,dsn="%scan(&dclib..MPE_X_TEST,2,.)"
,var_nm='DERIVED_KEY'
,var_deps='PRIMARY_KEY_FIELD'
,var_type='C'
,var_len=20
,var_fmt=''
,var_logic='cats(primary_key_field)'
,active=1;
quit;
%let f4=%mf_getuniquefileref();
data _null_;
file &f4 termstr=crlf;
put 'LIBDS:$43. COL:$32.';
put "&dclib..MPE_X_TEST,DERIVED_KEY";
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f4:iwant,
outlib=web4
)
data work.vals4;
set web4.vals;
putlog (_all_)(=);
run;
%mp_assertdsobs(work.vals4,
desc=Values are returned for a derived column,
test=HASOBS
)
/* tidy up the config so repeated runs start clean */
proc sql;
delete from &dc_libref..mpe_derived
where var_nm='DERIVED_KEY'
and upcase(libref)="%scan(&dclib..MPE_X_TEST,1,.)"
and upcase(dsn)="%scan(&dclib..MPE_X_TEST,2,.)";
quit;