This section describes how to use SUDAAN to estimate a mean ratio for all adults and for males and females separately. To illustrate this, the sum of calcium from milk is divided by the sum of total calcium for each population group as an example.
This section describes how to use SUDAAN and SAS to estimate mean ratios for all adults and for males and females separately. The illustrate this, the calcium from milk is divided by the sum of total calcium for each person and these ratios are averaged for each group as an example.
Sort the data by strata and PSU. Data must always be sorted first when using SUDAAN. In the sample code below, DTTOT is the dataset that was created for this analysis with the appropriate variables of interest.
For this analysis, DAY1RATIO is a variable that was created to represent the ratio of the amount of calcium from milk to the amount of total calcium for each individual on recall Day 1.
 
*-------------------------------------------------------------------------;
			
			* Use the PROC SORT procedure to sort the data by strata and 
			PSU.         ;
			
			*-------------------------------------------------------------------------; 
 
			data =DTTOT; 
			      
			by 
			SDMVSTRA SDMVPSU; 
 ; 
			*-------------------------------------------------------------------------;
			
			* Use the PROC DESCRIPT procedure in SUDAAN to compute a properly 
			weighted;
			* estimated mean ratio for all persons ages 
			20+.                          ;
			*-------------------------------------------------------------------------; 
 
			data =DTTOT; 
			
			      setenv decwidth=5 
			colwidth=  20 ; 
			
			
			      nest SDMVSTRA SDMVPSU;
			      
			weight 
			WTDRD1; 
			      subgroup RIAGENDR;
			      levels 
			2 ; 
			      
			var 
			DAY1RATIO; 
			      
			tables 
			RIAGENDR; 
			      subpopn usedat= 1 /name= "Age 
			20+ with reliable Day1 recall" ; 
			
			
			      rtitle
			
			"Mean Ratios" ; 
 ; 
For Subpopulation: Age 20+ with reliable Day1 recall   
Mean Ratios 
          
Number of observations read    :   9034    Weighted count :286222757
Number of observations skipped :   1088                
(WEIGHT variable nonpositive)                          
Observations in subpopulation  :   4448    Weighted count:205284669 
Denominator degrees of freedom :     15                
Variance Estimation Method: Taylor Series (WR)         
by: Variable, Gender - Adjudicated.                    
            
-----------------------------------------------------------------------------------------------------------
|                 |                  |                                                                    |
| Variable        |                  | Gender - Adjudicated                                               |
|                 |                  | Total                | male                 | female               |
-----------------------------------------------------------------------------------------------------------
|                 |                  |                      |                      |                      |
| DAY1RATIO       | Sample Size      |           4447.00000 |           2134.00000 |           2313.00000 |
|                 | Weighted Size    |      205081760.39614 |       98461101.74649 |      106620658.64965 |
|                 | Total            |       15659108.92268 |        8212141.01881 |        7446967.90388 |
|                 | Lower 95% Limit  |                      |                      |                      |
|                 |  Total           |       11604497.09333 |        6113268.12078 |        5227756.20478 |
|                 | Upper 95% Limit  |                      |                      |                      |
|                 |  Total           |       19713720.75203 |       10311013.91683 |        9666179.60298 |
|                 | Mean             |              0.07636 |              0.08340 |              0.06985 |
|                 | SE Mean          |              0.00469 |              0.00473 |              0.00686 |
|                 | Lower 95% Limit  |                      |                      |                      |
|                 |  Mean            |              0.06635 |              0.07333 |              0.05523 |
|                 | Upper 95% Limit  |                      |                      |                      |
|                 |  Mean            |              0.08636 |              0.09348 |              0.08446 |
---------------------------------------------------------------------------------------------------------- 
 
Highlights from the output include: