10-27-2010 12:10 PM
10-27-2010 02:58 PM
10-29-2010 04:28 AM
10-29-2010 06:48 PM
10-30-2010 01:51 PM
11-03-2010 03:27 AM
11-30-2012 08:44 PM
how can i prevent producing the first row of each Regoin using Proc Report.
|The SAS System|
12-02-2012 11:10 PM
I don't understand what you mean exactly --- 'the first row of each Regoin ' ?
You want delete obs which are the first obs in each region group in TEMP dataset ? That is easy.
if region ne lag(region) then delete;
12-03-2012 01:56 PM
Thank you for your code.
Yes. we can use one more data step to get rid of the first row.
My interested is if there is any statement or option in REPORT procendure can do that?
to me, i only need the last row of each region which show me the total sales and unique agent.
so my question could be if there is any way to create the temp data show the last row of each region only?
12-03-2012 08:55 PM
That is easy. Just add a filter condition on the TEMP dataset.
proc report data = test nowd out=temp(where=(agentid is missing));
But I prefer to use SQL.
create table want as
select region,sum(sales) as sum_sales,count(distinct agentid) as NumofAgentId
group by region;
12-04-2012 04:11 PM
As we known, we can summarizing data using group by wtih cube / rollup in SQL server.
i dont think SAS proc sql has this option.
i am alway struggling with decision of using proc mean/report/tabulate or proc sql for summarizing data.
with your great SAS programming experince, what's your thoughts and recommendation.
12-04-2012 10:12 PM
Well, I would firstly choose SQL way, which is more fast and more flexible and more succinct .Sure of course, If you want some special statistical estimator ,I will use proc means, SQL has some limitation about yielding these special statistical estimator . and I will use proc report / tabulate if you want some beautiful report or PDF/HTML .