Home
Why PROC SURVEYFREQ Does Not Have a DOMAIN Statement and How to Use It Correctly
In the ecosystem of SAS survey procedures, PROC SURVEYFREQ stands out for a specific reason that often puzzles even experienced statisticians: it does not support a DOMAIN statement. If you are transitioning from PROC SURVEYMEANS, PROC SURVEYREG, or PROC SURVEYLOGISTIC, you are likely accustomed to using the DOMAIN statement to perform subgroup analysis. However, attempting to use this syntax in PROC SURVEYFREQ will result in a syntax error.
The absence of the DOMAIN statement is not a functional limitation, but rather a design choice rooted in how frequency tables and cross-tabulations work within complex sample designs. This article clarifies why the statement is missing and provides a comprehensive guide on performing statistically valid subpopulation analyses using the correct syntax.
Understanding the Absence of the DOMAIN Statement
In SAS/STAT software, the DOMAIN statement is typically used to request separate analyses for subpopulations. When analyzing survey data, it is critical not to simply subset the data (using WHERE or IF statements) because the procedure needs the information from the full sample to correctly estimate the variance (standard errors).
While most survey procedures require a dedicated DOMAIN statement to handle this logic, PROC SURVEYFREQ achieves the exact same result through its TABLES statement. By design, any multi-way table request that crosses a subpopulation variable with an analysis variable performs a valid domain analysis.
The Direct Answer: How to Perform Domain Analysis
To perform a domain analysis in PROC SURVEYFREQ, you include the domain variable as the first variable in a cross-tabulation request within the TABLES statement.
Incorrect expectation:
-
Topic: 36569 - How do I run a Domain or Subgroup analysis in PROC SURVEYFREQ?https://support.sas.com/kb/36/569.html
-
Topic: SAS/STAT® 9.3 User's Guide The SURVEYFREQ Procedure (Chapter)https://support.sas.com/documentation/onlinedoc/stat/930/surveyfreq.pdf
-
Topic: Proc Surveyfreq: Why Do a Three Way Table in SAS When We Want Two Way Table Information?http://www.scsug.org/SCSUGProceedings/2011/mehta2/Proc%20Surveyfreq%20-%20Why%20Do%20a%20Three%20Way%20Table%20in%20SAS%20When%20We%20Want%20Two%20Way%20Table%20Information.pdf