07-06-2015 09:18 AM
I have a problem. I do so as from a table with 100 rows bait a table with rows that have that condition. By turning the macro made sas erases and writes the new data set and then instead of 4 lines provided only one that comes out the end of the dataset.
%macro xxx ();
%do i=1 %to 24;
if &var eq "AAA" or &var eq "BBB" or &var eq "CCC" then delete;
thank's a lot
bie bie m
07-06-2015 09:35 AM
I have a table of 100 rows and 3 columns. who call hour01 hour02 hour03. I try to find in these three columns if data is different from "AAA", "BBB" and "CCC". If it is different then I write in a table. So if there are three lines that read "LLL" I find myself in the new table three lines.
07-06-2015 09:44 AM
So far, there is no use for macros here. You could easily code:
if hour01 not in ('AAA', 'BBB', 'CCC') then output;
else if hour02 not in ('AAA', 'BBB', 'CCC') then output;
else if hour03 not in ('AAA', 'BBB', 'CCC') then output;
Is that close to what you need?
07-06-2015 09:47 AM
Try posting a datastep with some test data and required output as your logic isn't hard to follow. Why do you need a macro? Why not just do:
where col1 in ("aaa","bbb","ccc") or col2 in ("aaa","bbb","ccc") or col3 in ("aaa","bbb","ccc");
07-06-2015 09:51 AM
You should only use macro logic to generate SAS code when you cannot do what you want with the basic language.
data want ;
set have ;
array hr hour01-hour24 ;
do over hr ;
if hr not in ('AAA','BBB','CCC') then bad=1;