Hi, I was wondering if I could add log message to a dataset I'am using the macro VarExists(ds,var) as an example: %macro VarExist(ds,var); %local rc dsid result; %let dsid = %sysfunc(open(&ds)); %if %sysfunc(varnum(&dsid, &var)) > 0 %then %do; %let result = 1; %put Note: Var &var exists in %ds; %end; %else %do; %let result = 0; %put Note: Var &var not exists in &ds; %end; %let rc = %sysfunc(close(&dsid)); &result %mend VarExists; %varexist(sashelpclass, aaa); I have little knowledge in SAS, but what I want (I will write a pseudo code below) is if result = 1: do nothing if result = 0: data want; input message $; datalines; Note: Var &var not exists in &ds \* here &var and &ds will be the macro input*\ ; so there will be a final dataset that looks like this: message var aaa not exists in sashelp.class Is there a way to do this? Thanks!
... View more