I have the following table statement:
table month * (GQBProduct all) , (sale_wt dispwt) * (sum pctsum <sale_wt>) ;
It works as it should but it's not quite what I want. How do I rewrite the statement such that it displays sale_wt, dispwt and the pctsum for dispwt/sale_wt but not the pctsum of the sale_wt/sale_wt (which is always 100%)?
Thanks,
Bill
Hi,
The easiest thing to do is change your parentheses so that you get a different keyword statistic (SUM?) used for sale_wt and disp_wt and then just use your PCTSUM<SALE_WT> with DISPWT, as shown in #2 below. I had to make some fake data, so the numbers are probably a bit wonky because of the variables I used as "stand-ins" for SALE_WT and DISPWT.
cynthia
** make some fake data;
data testit;
set sashelp.prdsale;
** only get 3 months;
where quarter = 1;
gqbproduct = prodtype;
sale_wt = actual/100;
dispwt = predict/100;
run;
ods html file='c:\temp\tab_examp.html' style=sasweb;
proc tabulate data=testit;
class gqbproduct month;
var sale_wt dispwt;
table month * (GQBProduct all) ,
(sale_wt dispwt) * (sum pctsum <sale_wt>)
/box='1) Original code';
table month * (GQBProduct all) ,
(sale_wt dispwt)*sum dispwt*(pctsum <sale_wt>)
/box='2) Changed Code';
run;
ods html close;
Hi,
The easiest thing to do is change your parentheses so that you get a different keyword statistic (SUM?) used for sale_wt and disp_wt and then just use your PCTSUM<SALE_WT> with DISPWT, as shown in #2 below. I had to make some fake data, so the numbers are probably a bit wonky because of the variables I used as "stand-ins" for SALE_WT and DISPWT.
cynthia
** make some fake data;
data testit;
set sashelp.prdsale;
** only get 3 months;
where quarter = 1;
gqbproduct = prodtype;
sale_wt = actual/100;
dispwt = predict/100;
run;
ods html file='c:\temp\tab_examp.html' style=sasweb;
proc tabulate data=testit;
class gqbproduct month;
var sale_wt dispwt;
table month * (GQBProduct all) ,
(sale_wt dispwt) * (sum pctsum <sale_wt>)
/box='1) Original code';
table month * (GQBProduct all) ,
(sale_wt dispwt)*sum dispwt*(pctsum <sale_wt>)
/box='2) Changed Code';
run;
ods html close;
Thank you Cynthia!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.