03-19-2012 06:07 PM
I'd like to store a a list of values from a file in a file in a macro variable. I then would like to select all the rows from a dataset that do not have a value stored in the macro variable. HEre's what I have so far:
select grp sum(total)
where grp not in (&list);
How do I get the variables in to the "list" macro variable? The values that should populate the "list" macro variable are from a column in a csv file.
03-19-2012 06:14 PM
First put it in a dataset.
data exclude ;
infile 'exclude.csv' dsd firstobs=2;
Then ... Since you have it in a dataset forget about the macro variable and just use the dataset in the query.
If you must put it into a macro variable use the INTO clause in PROC SQL select statement.
proc sql noprint ;
select distinct grp into :list separated by ' '