using where in sas macro when subsetting dataset -
i'm trying use in macro when subsetting dataset
option mprint mlogic; %macro subset_by_make (dsn, make); data temp; set &dsn(where = (make = &make)); run; %mend subset_by_make; %subset_by_make(sashelp.cars, acura);
but i'm getting error variable acura not on file sashelp.cars
how proceed/ maggie
you need make sure macro generates valid sas syntax. in case did not include quotes around string literal, sas interpreted string acura
generated macro variable name.
%macro subset_by_make (dsn, make); data temp; set &dsn(where = (make = "&make")); run; %mend subset_by_make;
Comments
Post a Comment