enterprise guide - SAS: Conditional choice of library -
enterprise guide - SAS: Conditional choice of library -
i have same table name in 2 different libraries, , want utilize status in origin take library utilize (sas enterprise guide). possible utilize variable library accomplish below?
if(txt = 'tst")
select * tst.tablename
else
select * form dev.tablename
the best way varies based on defines txt
. if choosing based on user input (in example, user chooses test or dev (or prod) database point to), best way in enterprise guide create prompt create macro variable, or secondarily straight create macro variable.
ben cochran's paper be prompt now: creating , using prompts in sas enterprise guide introduction topic, other sources online. can set prompt asks user environment point to, , define macro variable value of choosing. add together prompt programme need related to, , presto, works.
so in case, have set variable &env.
contains value of table name (tst
or dev
). have command libname value (so don't alter libname used, instead alter folder or database libname points to).
if you're not in eg, or if don't want utilize prompt whatever reason, can assign macro variable yourself.
%let env = tst;
either way, 1 time you've got &env=tst
established, utilize in open code:
proc sql; select * &env..tablename; quit;
or, said, assign libname based on macro variable , utilize single libname in code; that's cleaner, though leaves own complications.
sas enterprise-guide
Comments
Post a Comment