<?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 Column Percentages w/in a Domain in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYFREQ-Column-Percentages-w-in-a-Domain/m-p/819168#M323362</link>
    <description>&lt;P&gt;Have you tried including the ROW percentages in the output?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2022 15:58:31 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-06-20T15:58:31Z</dc:date>
    <item>
      <title>PROC SURVEYFREQ Column Percentages w/in a Domain</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYFREQ-Column-Percentages-w-in-a-Domain/m-p/819071#M323324</link>
      <description>&lt;P&gt;I'm analyzing weighted survey data using PROC SURVEYFREQ. Column percentages are automatically calculated using a denominator that includes the weighted frequency of BOTH&amp;nbsp;domain / flag_1 = 1 and domain / flag_1&amp;nbsp;= 0&amp;nbsp;(i.e.,&amp;nbsp;53649500) (See pic). So the column percentage is&amp;nbsp;2.7866%&amp;nbsp;(i.e.,&amp;nbsp;1494991 /&amp;nbsp;53649500 =&amp;nbsp;2.7866%).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-06-19 at 12.37.14 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72441i765238BCC02CBECE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-06-19 at 12.37.14 PM.png" alt="Screen Shot 2022-06-19 at 12.37.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;How can I confine the calculation of column percentages to a given domain, so that the denominator is the weighted frequency of domain = 1 (i.e., 2071466)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My desired column percentage calculation would be:&lt;/P&gt;
&lt;P&gt;1494991 /&amp;nbsp;2071466 = 72.171%&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my syntax:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyfreq data=&amp;amp;dataset nomcar;
 	stratum sdmvstra;
 	cluster sdmvpsu;
 	weight &amp;amp;weight;
	
 	/* DOMAIN: used instead of the WHERE or BY statement to provide analyses of subgroups.  */
	/* The DOMAIN statement is not available with the SURVEYFREQ procedure.  */
	/* Use the DOMAIN variable in the TABLES statement instead */
 	
 	TABLE
/* 	NHANES variables */
		flag_1*
		(
 		ever_used
		cann_use_status	
		cann_use_status2
		monthly_yr

/* 		time_since_monthly_use */
/* 		time_since_monthly_use_unit */
		times_month
		joints_pipes_day
/* 		last_used */
/* 		last_use_unit */
			
/* 		Calculated variables */
/* 		mos_since_last_use */
/* 		yrs_since_last_use */
/* 		mos_since_monthly_use */
/* 		yrs_since_monthly_use */
 		)
 		/ cl col chisq cellchi2 relrisk;
/*  	*year/ cl col chisq cellchi2 relrisk; */
 		
 	FORMAT 
/* 		NHANES variables */
 		ever_told_mi 			yes_no_fmt.
 		ever_used				ever_usedfmt.
 		cann_use_status			cann_use_statusfmt.
 		cann_use_status2		cann_use_status2fmt.
		
		monthly_yr				monthly_yrfmt.
		
		times_month				times_monthfmt.
		joints_pipes_day		joints_pipes_dayfmt.
		
		year 					yearfmt.
		
/* 		Calculated variables */
/* 		mos_since_last_use	*/
/* 		yrs_since_last_use */
/* 		mos_since_monthly_use	mos_since_monthly_usefmt.	 */
/* 		yrs_since_monthly_use */	
		;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jun 2022 19:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYFREQ-Column-Percentages-w-in-a-Domain/m-p/819071#M323324</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2022-06-19T19:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SURVEYFREQ Column Percentages w/in a Domain</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYFREQ-Column-Percentages-w-in-a-Domain/m-p/819168#M323362</link>
      <description>&lt;P&gt;Have you tried including the ROW percentages in the output?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 15:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYFREQ-Column-Percentages-w-in-a-Domain/m-p/819168#M323362</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-20T15:58:31Z</dc:date>
    </item>
  </channel>
</rss>

