<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: need help regarding counting N with respect to categorical in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/need-help-regarding-counting-N-with-respect-to-categorical/m-p/17692#M3391</link>
    <description>Because the data are in one row per person, you can get it with a FREQ TABLE statement like&lt;BR /&gt;
&lt;BR /&gt;
TABLES paper1*paper2;&lt;BR /&gt;
BY gender agegroup;&lt;BR /&gt;
&lt;BR /&gt;
then you just add up all the cells other than the 0-0 one for each age and sex category.&lt;BR /&gt;
&lt;BR /&gt;
With a DATA step, you could get at it more directly;&lt;BR /&gt;
&lt;BR /&gt;
DATA new;&lt;BR /&gt;
SET old;&lt;BR /&gt;
AnyPaper = paper1*paper2;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
PROC FREQ DATA=new;&lt;BR /&gt;
TABLES gender*agegroup*anypaper;&lt;BR /&gt;
RUN;</description>
    <pubDate>Fri, 07 May 2010 13:43:56 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2010-05-07T13:43:56Z</dc:date>
    <item>
      <title>need help regarding counting N with respect to categorical</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-regarding-counting-N-with-respect-to-categorical/m-p/17691#M3390</link>
      <description>Hi,&lt;BR /&gt;
I will be greatful if any one can help me to break the problem&lt;BR /&gt;
I have a dataset with following variables&lt;BR /&gt;
gender  agegroup  paper1  paper2 web1    web2 .........................&lt;BR /&gt;
1               1          1         0          0          1&lt;BR /&gt;
2               3          0         0          1          1&lt;BR /&gt;
1              2           1         1         1           0&lt;BR /&gt;
2              3           1         1          0         1&lt;BR /&gt;
&lt;BR /&gt;
gender 1=male,2=female&lt;BR /&gt;
age group 1=18-24, 2=25-30  3=31-35 &lt;BR /&gt;
paper read=1  not read=0&lt;BR /&gt;
&lt;BR /&gt;
i would like to find &lt;BR /&gt;
gender wise age group wise how many people read at least any of two&lt;BR /&gt;
&lt;BR /&gt;
Can any one can suggest the best way to find, please see my code&lt;BR /&gt;
Thanks &amp;amp; Regards,&lt;BR /&gt;
Suresh &lt;BR /&gt;
&lt;BR /&gt;
here is my code tried with Proc Freq and Proc Tabulate :&lt;BR /&gt;
PROC FREQ DATA=WORK.test&lt;BR /&gt;
	ORDER=INTERNAL&lt;BR /&gt;
;&lt;BR /&gt;
	TABLES gender / NOPERCENT NOCUM  SCORES=TABLE;&lt;BR /&gt;
	TABLES agegroup / NOPERCENT NOCUM  SCORES=TABLE;&lt;BR /&gt;
	BY paper1 paper2 web1 web2&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;CODE 2  WITH PROC TABULATE :&lt;/B&gt;&lt;BR /&gt;
PROC TABULATE&lt;BR /&gt;
DATA=work.test1&lt;BR /&gt;
	&lt;BR /&gt;
	;&lt;BR /&gt;
	CLASS gender /	ORDER=UNFORMATTED MISSING;&lt;BR /&gt;
	CLASS agegroup /	ORDER=UNFORMATTED MISSING;&lt;BR /&gt;
	CLASS paper1 /	ORDER=UNFORMATTED MISSING;&lt;BR /&gt;
	CLASS paper2 /	ORDER=UNFORMATTED MISSING;&lt;BR /&gt;
	CLASS web1 /	ORDER=UNFORMATTED MISSING;&lt;BR /&gt;
	CLASS web2 /	ORDER=UNFORMATTED MISSING;&lt;BR /&gt;
	TABLE /* Row Dimension */&lt;BR /&gt;
paper1&lt;BR /&gt;
paper2&lt;BR /&gt;
web1&lt;BR /&gt;
web2&lt;BR /&gt;
&lt;BR /&gt;
/* Column Dimension */&lt;BR /&gt;
gender*&lt;BR /&gt;
  agegroup*&lt;BR /&gt;
    N 		;&lt;BR /&gt;
	;&lt;BR /&gt;
&lt;BR /&gt;
RUN;</description>
      <pubDate>Fri, 07 May 2010 12:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-regarding-counting-N-with-respect-to-categorical/m-p/17691#M3390</guid>
      <dc:creator>ssas</dc:creator>
      <dc:date>2010-05-07T12:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: need help regarding counting N with respect to categorical</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/need-help-regarding-counting-N-with-respect-to-categorical/m-p/17692#M3391</link>
      <description>Because the data are in one row per person, you can get it with a FREQ TABLE statement like&lt;BR /&gt;
&lt;BR /&gt;
TABLES paper1*paper2;&lt;BR /&gt;
BY gender agegroup;&lt;BR /&gt;
&lt;BR /&gt;
then you just add up all the cells other than the 0-0 one for each age and sex category.&lt;BR /&gt;
&lt;BR /&gt;
With a DATA step, you could get at it more directly;&lt;BR /&gt;
&lt;BR /&gt;
DATA new;&lt;BR /&gt;
SET old;&lt;BR /&gt;
AnyPaper = paper1*paper2;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
PROC FREQ DATA=new;&lt;BR /&gt;
TABLES gender*agegroup*anypaper;&lt;BR /&gt;
RUN;</description>
      <pubDate>Fri, 07 May 2010 13:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/need-help-regarding-counting-N-with-respect-to-categorical/m-p/17692#M3391</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2010-05-07T13:43:56Z</dc:date>
    </item>
  </channel>
</rss>

