Dear Friends,
Here i need results like village wise and year wise total and percentage. but i am trying with the below code but it not works. Please help me in this.
proc tabulate data=paper.Role_gender_in_;
class Village year Activity_Name men Women both;
tables (Village * year * Activity_Name), Women (n colpctn) /printmiss misstext=' ' ;
format Women AWM_.;
run; bula
Hi, your TABULATE statement is missing a table operator. So, this specification: Women(n colpctn) is incorrect. Usually, one would expect to see Women*(n colpctn); Take a look at the output from this example, I added the ALL to show you the COLPCTN was working.
Cynthia
ods html file='c:\temp\example_tab.html';
proc tabulate data=sashelp.prdsale;
class product year region prodtype ;
tables (product * year * region) all,
prodtype *(n colpctn) /printmiss misstext=' ' ;
run;
ods html close;
Hi,
TBH I don't use proc tabulate, so maybe someone who does can help you there. For this type of thing I would just go directly to an output dataset of (and note you have not provided test data or required output so guessing):
proc sql;
create table WANT as
select AGE,
SEX,
COUNT(SEX) as TOT,
(COUNT(SEX) / (select COUNT(*) from SASHELP.CLASS)) * 100 as PCENT
from SASHELP.CLASS
group by AGE,
SEX;
quit;
Then use proc report to generate some nice output.
Hi, your TABULATE statement is missing a table operator. So, this specification: Women(n colpctn) is incorrect. Usually, one would expect to see Women*(n colpctn); Take a look at the output from this example, I added the ALL to show you the COLPCTN was working.
Cynthia
ods html file='c:\temp\example_tab.html';
proc tabulate data=sashelp.prdsale;
class product year region prodtype ;
tables (product * year * region) all,
prodtype *(n colpctn) /printmiss misstext=' ' ;
run;
ods html close;
Dear Cynthia,
Suppose in your example i need subtotal and percentage for product wise how to go with that code?
can you explain to me please that is what exactly i was looking.
Thanks and Regards,
Anil
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.