Hi, I am running this macro to create a dataset, but it is creating all datasets even when there is no data. Data have: datalines; Input id var; 1 abc 2 xyz 3 abc 4 5 6 abc 7 xyz; I want to create datasets based on the var; if var= "abc" or if var="xyz"; then create abc dataset or xyz datset but if the value ne to these or blank then no output. My macro looks like this: %macro test (var=); data &var; set have; if var NE " " then do; if var = "&var" then output; end; run; %mend test; %test(var=xyz); %test (var=abc); %test (var=ijk); It is creating dataset ijk with 0 observations, I dont want that, I want only two datasets (abc, and xyz), but I have to run the macro for ijk because data keeps changing and next week there might be some observations = ijk. Help Thanks
... View more