Hi All, Would you please let me know the way to write out an error or warning message along with the name given in the varlist which is not in the input dataset. For example, %varlist= a b c d; and variable d is not in the input 'CLASS' dataset I would like to the display in the log the following message after running names1 datasets. 'Variable 'D' is not in the CLASS dataset.' or if variable D and C are not in the class dataset then the message 'Variable C and D are not in the CLASS dataset.' And after that system should abort or go to the end instead running next data step. %let varlist= a b c d; %let varlist_quotesAndcomma="%sysfunc(prxchange(s/\s+/%nrbquote(",")/i,-1,&varlist))"; %put &=varlist_quotesAndcomma; DATA checkdata; %DO _t = 1 %TO %sysfunc(countw("&varlist",' ')); name = strip(scan("&&varlist",&_t," ")); OUTPUT; %END; RUN; data names (keep=name); set dictionary.columns( where =( libname='SASHELP' and memname='CLASS' and upcase(name) in (%upcase(&varlist_quotesAndcomma)))); run; data names1; merge names(in=names) checkdata(in=checkdata); if checkdata and not names; run; Thank you!
... View more