Hi! I thought I would have no problems with ordering (it has seemed clear to me) but I've got some unexpected result. And can't find reasons why it is going like that. And in consequence of that I get wrong report. Can anyone show me where am I wrong? Example: data sales; input agent$ sale; datalines; agent1 1 agent2 4 agent3 3 agent6 1 agent4 2 agent5 7 ; run; /*need to place certain agents in a special group ('others') in the end of agent's list sorted in descending order for every region*/ proc sql; create table for_report as select (case when agent in ('agent1','agent2','agent6') then 'city1' when agent in ('agent3','agent4','agent5') then 'city2' end) as region, (case when agent in ('agent5','agent6') then 'others' else agent end) as agent_info, sale, (case when agent in ('agent5','agent6') then -1 else sale end) as ordsale from work.sales order by region,ordsale desc; quit; proc report data=for_report nowd; column region agent_info sale ordsale; define region / group order=data; define agent_info / group order=data; define sale /group order=data; define ordsale /group order=data /*noprint*/; run; After proc sql I get the result I need, but after proc report - unexpected(( (though I'm trying to 'save' proc sql results)
... View more