<?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 PROC SURVEYMEANS - Domain &amp;amp; Class Statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYMEANS-Domain-amp-Class-Statements/m-p/814965#M321696</link>
    <description>&lt;P&gt;I'm trying to use PROC SURVEYMEANS to analyze continuous variables from a weighted survey&amp;nbsp;(i.e., NHANES).&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Survey-Data-Analysis-Made-Easy-With-SAS/ta-p/733313" target="_self"&gt;This&lt;/A&gt;&amp;nbsp;article has been helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to look at age (continuous) by year, in a subpopulation defined by a flag variable (i.e., flag_1).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveymeans DATA=nhanes.go nomcar;
 	STRATUM sdmvstra;
 	CLUSTER sdmvpsu;
 	WEIGHT wtmec10yr_09_18;
 	
/* DOMAIN: used instead of the WHERE or BY statement to provide analyses of subgroups.  */
	domain flag_1 year;
	var age_yrs;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When both flag_1 and year are included in the DOMAIN statement, I get the mean of age_yrs by flag_1 (0, 1) and by year, but not by both (see screenshot).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-05-24 at 2.55.59 PM.png" style="width: 588px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71744iEBBADF2590965742/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-05-24 at 2.55.59 PM.png" alt="Screen Shot 2022-05-24 at 2.55.59 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I am seeking the mean of age_yrs by year when flag_1 = 1.&lt;/P&gt;
&lt;P&gt;I've tried adding a CLASS statement to no avail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any suggestions.&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2022 21:59:22 GMT</pubDate>
    <dc:creator>_maldini_</dc:creator>
    <dc:date>2022-05-24T21:59:22Z</dc:date>
    <item>
      <title>PROC SURVEYMEANS - Domain &amp; Class Statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYMEANS-Domain-amp-Class-Statements/m-p/814965#M321696</link>
      <description>&lt;P&gt;I'm trying to use PROC SURVEYMEANS to analyze continuous variables from a weighted survey&amp;nbsp;(i.e., NHANES).&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Survey-Data-Analysis-Made-Easy-With-SAS/ta-p/733313" target="_self"&gt;This&lt;/A&gt;&amp;nbsp;article has been helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to look at age (continuous) by year, in a subpopulation defined by a flag variable (i.e., flag_1).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveymeans DATA=nhanes.go nomcar;
 	STRATUM sdmvstra;
 	CLUSTER sdmvpsu;
 	WEIGHT wtmec10yr_09_18;
 	
/* DOMAIN: used instead of the WHERE or BY statement to provide analyses of subgroups.  */
	domain flag_1 year;
	var age_yrs;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When both flag_1 and year are included in the DOMAIN statement, I get the mean of age_yrs by flag_1 (0, 1) and by year, but not by both (see screenshot).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-05-24 at 2.55.59 PM.png" style="width: 588px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71744iEBBADF2590965742/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-05-24 at 2.55.59 PM.png" alt="Screen Shot 2022-05-24 at 2.55.59 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I am seeking the mean of age_yrs by year when flag_1 = 1.&lt;/P&gt;
&lt;P&gt;I've tried adding a CLASS statement to no avail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 21:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYMEANS-Domain-amp-Class-Statements/m-p/814965#M321696</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2022-05-24T21:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SURVEYMEANS - Domain &amp; Class Statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYMEANS-Domain-amp-Class-Statements/m-p/814967#M321698</link>
      <description>&lt;P&gt;From the documentation:&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV id="statug.surveymeans.domainstmt" class="AAsection"&gt;
&lt;P&gt;If two or more variables are joined by asterisks (&lt;SPAN class=" AAstar"&gt;*&lt;/SPAN&gt;), then every possible combination of levels of these variables determines a domain&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use this you should get the desired result.&lt;/P&gt;
&lt;P&gt;Domain flag_1 * year;&lt;/P&gt;
&lt;P&gt;If you want the individual domains and the combined use:&lt;/P&gt;
&lt;P&gt;Domain flag_1 * year&amp;nbsp;&amp;nbsp; flag_1&amp;nbsp; year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 May 2022 23:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SURVEYMEANS-Domain-amp-Class-Statements/m-p/814967#M321698</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-24T23:10:27Z</dc:date>
    </item>
  </channel>
</rss>

