Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
macmillanator
Calcite | Level 5

I am analyzing complex survey data using proc surveyfreq in SAS 9.4. I have produced a crosstab table using the following code:

 

proc surveyfreq data=analysis missing nosummary;
    table var1*var2/ row CVWT;
    weight new_weight;
run;

 

According to the SAS User's Guide, the coefficients of variation for weighted frequencies (CVWT) is calculated from the table as follows: 

For the total in table cell , the coefficient of variation is computed as 

    

where  is the estimate of the total in table cell  and  is the standard error of the estimate.

 

I want to manually calculate the CVWT from the raw data. How do I do this?

 

Note1: I have tried Sqrt((1 - p) / np) using the new_weight variable but no luck i.e. doesn't match the CVWT in the SAS output. 

Note2: The reason for wanting to do this is allow users to explore any combination of the survey variables in Tableau and display the weighted frequencies along with the appropriate CV (calculated on the fly).  

 

Thanks for any insight you can offer! 

 

 

 

 

 

1 REPLY 1
macmillanator
Calcite | Level 5

Solved.

 

Ensure you calculate the standard deviation of the SUM of the weighted frequencies and not the standard deviation of the mean.

 

    stdev(Xsum) = sqrt(N) * stdev(X)

 

The formula from the SAS User's guide can then be used to calculate the CVWT.

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2391 views
  • 0 likes
  • 1 in conversation