View Full Version : weird logical doubt


karthikeya_ivb
04-08-2009, 08:14 AM
hi all,

i'm struck with a weird problem and would be great if any one can help me out. i have my data in store--upc--week--dollar format. the weeks are like 1, 2,3,...11. now i want to know
1.how many upcs are present in week1 and week3 but not in week 2
2.how many upcs are present in week1 and week4 but not in week2, week3.
3.how many upcs are present in week1 and week5 but not in week2, week3, week4.

and so on.

best,
-Karthik

sasguru
04-09-2009, 12:28 PM
you can use proc sql.

Proc sql;
select count(*) from Datasetname where week in('week1','week3') and week not in('week2');
quit;

karthikeya_ivb
05-19-2009, 03:26 AM
hi

the above mentioned method is not working.
can any one throw some light on why it is not working?

best,
-Karthik

vinux
05-19-2009, 05:47 AM
what is this upc? i guess it is unique for each week.

Try this too.


data aa;
set Datasetname ;
where week in('week1','week3')
;
run;

data bb;
set Datasetname ;
where week in('week2')
;
run;
proc sort data= aa; by upc;run;
proc sort data= bb; by upc;run;

data cc;
merge aa ( in =a) bb(in =b);
by upc;
if a not b;
run;