@TimurShangareev wrote:
Is there any method, where I can extract dataset name from expressions like:
<work.ds(...where=(...))>
<ds(... where=(...))>
or somehow check that this expression is valid in macro calls (wthout PROC or DATA statements)?
It would help if you explained in more detail what you actually mean. Perhaps some example use cases would help?
You mentioned macro calls. So in macro code here are a couple of simple things.
%let dsn=sashelp.class(where=(age>11));
%let valid=FALSE;
%let dsid=%sysfunc(open(&dsn));
%if &dsid %then %do;
%let valid=TRUE;
%let dsid=%sysfunc(close(&dsid));
%end;
%let name_only=%scan(&dsn,1,());
%let options=%substr(&dsn%str( ),%length(&name_only)+1);
%let memname=%scan(&name_only,-1,.);
%let libref=%scan(WORK.&name_only,-2,.);
%put &=dsn &=valid ;
%put &=name_only &=options;
%put &=libref &=memname ;
... View more