## How to obtain weighted estimates from Proc Tabulate

Solved
Occasional Contributor
Posts: 9

# How to obtain weighted estimates from Proc Tabulate

Hello,

Using the code below does not generate weighted estimates. Is there a different way to get the expected results?

proc tabulate data = parents vardef=weight;

weight pwpwgt;

class parseg;

table parseg =' ' all,

n*f=7.0 pctn*f=9.1 /rts=25;

keylabel pctn = 'Percent'

all = 'Total';

format parseg prselfm.;

title 'Weighted Estimates Using vardef=weight in Proc Tabulate';

run;

Reference for vardef=weight:

https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473731.htm#a000068934

Thanks,

Artp

Accepted Solutions
Solution
‎06-02-2017 11:51 AM
Super User
Posts: 13,563

## Re: How to obtain weighted estimates from Proc Tabulate

[ Edited ]

Artp wrote:

Thank you Grand Advisor for your feedback. This is the first time I am learning Proc Tabulate to analyze a huge survey data set. Can you please be more explicit?

Regards,

Artp

Is your survey sample from a simple random sample? If not such as a stratified sample, a cluster sample or almost any other sample type you may need to be looking into the Survey procs such as Surveymeans SurveyFreq SurveyLogistic and SurveyReg for analysis.

I would likely only use tabulate for the raw data to get a feel for sample counts, which your code did, and check skip patterns or recoding of variables.

Or display of values summarized from the survey procs.

All Replies
Super User
Posts: 13,563

## Re: How to obtain weighted estimates from Proc Tabulate

Tabulate N statistic reports just than, the number of values not the weighted n. You may want to consider adding a dummy variable with the value of 1 for each record, use that as a Var variable and request the sum and pctsum of that variable.

Occasional Contributor
Posts: 9

## Re: How to obtain weighted estimates from Proc Tabulate

Thank you Grand Advisor for your feedback. This is the first time I am learning Proc Tabulate to analyze a huge survey data set. Can you please be more explicit?

Regards,

Artp

Solution
‎06-02-2017 11:51 AM
Super User
Posts: 13,563

## Re: How to obtain weighted estimates from Proc Tabulate

[ Edited ]

Artp wrote:

Thank you Grand Advisor for your feedback. This is the first time I am learning Proc Tabulate to analyze a huge survey data set. Can you please be more explicit?

Regards,

Artp

Is your survey sample from a simple random sample? If not such as a stratified sample, a cluster sample or almost any other sample type you may need to be looking into the Survey procs such as Surveymeans SurveyFreq SurveyLogistic and SurveyReg for analysis.

I would likely only use tabulate for the raw data to get a feel for sample counts, which your code did, and check skip patterns or recoding of variables.

Or display of values summarized from the survey procs.

Occasional Contributor
Posts: 9

## Re: How to obtain weighted estimates from Proc Tabulate

Hello ballardw,

Your contribution is uplifting! I don't like going on weekends with unsolved mysteries. My problem was how to present the outputs from survey procedures (Surveyfreq and Surveymeans) - weighted freqs/estimates - in refined tables like those from Proc Tabulate or Report.

Archer R. Gravely's book "Your Guide To Survey Research Using the SAS System" does an excellent job presenting survey data tables/reports.

Have a great weekend,

Artp

Super User
Posts: 10,784

## Re: How to obtain weighted estimates from Proc Tabulate

Did you try option of VAR statement.

``````proc tabulate data=sashelp.class;
class sex;
var height/weight=age;
table sex,height*mean;
run;``````
Occasional Contributor
Posts: 9

## Re: How to obtain weighted estimates from Proc Tabulate

Hi Ksharp,

SAS did not like the inclusion of "/weight=age" ; log said, "unknown variable."

Thank you,

Artp

Super User
Posts: 13,563

## Re: How to obtain weighted estimates from Proc Tabulate

Artp wrote:

Hi Ksharp,

SAS did not like the inclusion of "/weight=age" ; log said, "unknown variable."

Thank you,

Artp

The variable name after Weight= should be YOUR weight variable. Age was an example for the SASHELP.CLASS data set.

☑ This topic is solved.