I Have to run to edit check query on table having collumns customerid, product and orderno.
ordernumber has values(1-5). not all ordernumbers(1-5) are valid for every product.If the same product has all the values from 1-5 , then it is discrepancy. I need to pull out those records with discrepany.
ID product orderno
001 apple 1
001 apple 2
001 apple 3
001 apple 4
001 apple 5
002 orange 1
002 orange 3
003 banana 1
003 banana 2
004 berry 1
004 berry 2
In the above table id(001) with product apple is discrepany because it has all the values 1-5. i need to pull out those reocord from the table.
Thansk in advance
Rakesh
Something like this (not tested)
Proc sql ;
create table want as
select a.*
from have a
, (Select product
, count (distinct order) as tot
from have
) b
where a.product = b.product
and b.tot = 5
;
quit ;
Richard
Thanks Richard......
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.