<?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: proc surveyfreq in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9135#M547</link>
    <description>Neil,&lt;BR /&gt;
&lt;BR /&gt;
I'm no familiar with surveyfreq.&lt;BR /&gt;
&lt;BR /&gt;
And if you want to get the percentages of each 'status' within a 'sex' group seperately. That means only one way, I think you can only define status in table statement. Otherwise status*sex should be two ways.&lt;BR /&gt;
&lt;BR /&gt;
As my understanding you have to write table statements twice, one for one way percentage calculation, and the other one fore getting estimates. Like below..&lt;BR /&gt;
&lt;BR /&gt;
proc ..;&lt;BR /&gt;
tables status ...&lt;BR /&gt;
tables sex*status ...;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PJ</description>
    <pubDate>Thu, 29 Apr 2010 18:36:39 GMT</pubDate>
    <dc:creator>P_J</dc:creator>
    <dc:date>2010-04-29T18:36:39Z</dc:date>
    <item>
      <title>proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9130#M542</link>
      <description>Hi Colleagues,&lt;BR /&gt;
&lt;BR /&gt;
I have a data set like this.&lt;BR /&gt;
&lt;BR /&gt;
data food;&lt;BR /&gt;
input id sex status wt;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 1 1 33&lt;BR /&gt;
2 2 1 33&lt;BR /&gt;
3 1 2 33&lt;BR /&gt;
4 2 2 10&lt;BR /&gt;
5 1 1 10&lt;BR /&gt;
6 1 2 10&lt;BR /&gt;
7 1 2 33&lt;BR /&gt;
8 2 2 10&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/*Id        = id*/&lt;BR /&gt;
/*Sex     = sex of respondent (1=male, 2= female)*/&lt;BR /&gt;
/*Status     = food security status (1=secure, 2=insecure)*/&lt;BR /&gt;
/*Wt         = weight variable*/&lt;BR /&gt;
&lt;BR /&gt;
Using proc surveyfreq, I have generated the cross tabs for the&lt;BR /&gt;
population. &lt;BR /&gt;
&lt;BR /&gt;
proc surveyfreq data=food;&lt;BR /&gt;
tables sex*status;&lt;BR /&gt;
weight wt;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Finally however my report has to present the frequency counts and associated percentages for the following combinations: &lt;BR /&gt;
Sex 1 &amp;amp; Status 1&lt;BR /&gt;
Sex 1 &amp;amp; Status 2&lt;BR /&gt;
Sex 2 &amp;amp; Status 1&lt;BR /&gt;
Sex 2 &amp;amp; Status 2&lt;BR /&gt;
&lt;BR /&gt;
SAS output presents the frequency counts and associated percentages differently. So, I am manually calculating the percentages for the above combinations using the freq counts generated by SAS output.&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;Query: Would there be any optional statements in the proc surveyfreq that would straight a way generate the percentages of my interest.&lt;/B&gt;&lt;BR /&gt;
Thank you for the inputs.&lt;BR /&gt;
&lt;BR /&gt;
Neil</description>
      <pubDate>Fri, 23 Apr 2010 15:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9130#M542</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-04-23T15:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9131#M543</link>
      <description>It seems to me that proc surveyfreq is producing what you need.  This is the output I get when I use the code you provided (with a few options turned off).  Am I misunderstanding your question?&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
                                     Table of sex by status&lt;BR /&gt;
&lt;BR /&gt;
                                                Weighted&lt;BR /&gt;
                             sex    status     Frequency    Percent&lt;BR /&gt;
                             ------------------------------------------------------&lt;BR /&gt;
                               1         1      43.00000    25.0000&lt;BR /&gt;
                                         2      76.00000    44.1860&lt;BR /&gt;
                             -----------------------------------------------------&lt;BR /&gt;
                               2         1      33.00000    19.1860&lt;BR /&gt;
                                         2      20.00000    11.6279&lt;BR /&gt;
                             ------------------------------------------------------&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 23 Apr 2010 21:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9131#M543</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2010-04-23T21:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9132#M544</link>
      <description>Hi Colleague (1162),&lt;BR /&gt;
&lt;BR /&gt;
Many thanks for this. Yes this is the output I also get.&lt;BR /&gt;
&lt;BR /&gt;
But I need to get the percentages of each 'status' within a 'sex' group seperately. &lt;BR /&gt;
&lt;BR /&gt;
For example, &lt;BR /&gt;
Sex 1 and Status 1 =36.13% (but the output gives 25%)&lt;BR /&gt;
Sex 1 and Status 2 = 63.86% (but the output gives 44%)&lt;BR /&gt;
Sex 2 and Status 1 = 62.26% and so on.&lt;BR /&gt;
&lt;BR /&gt;
I am extracting the output into an Excel sheet and manually calculating the needed % s but it takes time as I have 50 such output tables.&lt;BR /&gt;
&lt;BR /&gt;
So, is there any optional statement in proc surveyfreq to calculate the desired %s within SAS itself.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
One more thing, could you also please let me know how did you make it to appear your SAS output table in the psoted messege? I tried but tables are not accepted in messege box.&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Neil</description>
      <pubDate>Thu, 29 Apr 2010 16:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9132#M544</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-04-29T16:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9133#M545</link>
      <description>Do you mean the results like below ?&lt;BR /&gt;
&lt;BR /&gt;
sex=1 status=1 COUNT=43 PERCENT=36.134453782&lt;BR /&gt;
sex=1 status=2 COUNT=76 PERCENT=63.865546218&lt;BR /&gt;
sex=2 status=1 COUNT=33 PERCENT=62.264150943&lt;BR /&gt;
sex=2 status=2 COUNT=20 PERCENT=37.735849057&lt;BR /&gt;
&lt;BR /&gt;
Then please try by adding by sex;&lt;BR /&gt;
&lt;BR /&gt;
proc freq data=food;&lt;BR /&gt;
by sex ;&lt;BR /&gt;
tables status /nocum out=food1;&lt;BR /&gt;
weight wt;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 29 Apr 2010 17:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9133#M545</guid>
      <dc:creator>P_J</dc:creator>
      <dc:date>2010-04-29T17:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9134#M546</link>
      <description>Hi P.J.&lt;BR /&gt;
&lt;BR /&gt;
Of course yes. Those are exactly the percentages that I need for four combinations of sex and status. I am calculating these % s seperately in Excel (manualy) which takes ages.&lt;BR /&gt;
&lt;BR /&gt;
However, following program does not generate it.&lt;BR /&gt;
&lt;BR /&gt;
proc freq data=food;&lt;BR /&gt;
by sex ;&lt;BR /&gt;
tables status /nocum out=food1;&lt;BR /&gt;
weight wt;&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Could you please help. Besides, it should be 'proc surveyfreq' and not just 'proc freq' as I am trying to generate estimates for entire population. And shouldn't the the third statement include status*sex as I am estimating the cross tabs?&lt;BR /&gt;
&lt;BR /&gt;
Neil</description>
      <pubDate>Thu, 29 Apr 2010 17:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9134#M546</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-04-29T17:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9135#M547</link>
      <description>Neil,&lt;BR /&gt;
&lt;BR /&gt;
I'm no familiar with surveyfreq.&lt;BR /&gt;
&lt;BR /&gt;
And if you want to get the percentages of each 'status' within a 'sex' group seperately. That means only one way, I think you can only define status in table statement. Otherwise status*sex should be two ways.&lt;BR /&gt;
&lt;BR /&gt;
As my understanding you have to write table statements twice, one for one way percentage calculation, and the other one fore getting estimates. Like below..&lt;BR /&gt;
&lt;BR /&gt;
proc ..;&lt;BR /&gt;
tables status ...&lt;BR /&gt;
tables sex*status ...;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PJ</description>
      <pubDate>Thu, 29 Apr 2010 18:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9135#M547</guid>
      <dc:creator>P_J</dc:creator>
      <dc:date>2010-04-29T18:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9136#M548</link>
      <description>Hi P.J.,&lt;BR /&gt;
&lt;BR /&gt;
Splendid!&lt;BR /&gt;
&lt;BR /&gt;
Your program preceded by proc sort generated the % s I was exactly looking for. It worked with proc surveyfreq as well, so you have saved my time tremendously.&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much.&lt;BR /&gt;
&lt;BR /&gt;
These are the programs.&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=food;&lt;BR /&gt;
by sex;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc surveyfreq data=food;&lt;BR /&gt;
by sex ;&lt;BR /&gt;
tables status ;&lt;BR /&gt;
weight wt;&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Neil</description>
      <pubDate>Thu, 29 Apr 2010 21:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-surveyfreq/m-p/9136#M548</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-04-29T21:36:31Z</dc:date>
    </item>
  </channel>
</rss>

