BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Artp
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@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.

View solution in original post

7 REPLIES 7
ballardw
Super User

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.

Artp
Fluorite | Level 6

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 

ballardw
Super User

@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.

Artp
Fluorite | Level 6

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

Ksharp
Super User

Did you try option of VAR statement.

 

proc tabulate data=sashelp.class;
class sex;
var height/weight=age;
table sex,height*mean;
run;
Artp
Fluorite | Level 6

Hi Ksharp,

 

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

 

Thank you,

 

Artp

ballardw
Super User

@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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 3658 views
  • 0 likes
  • 3 in conversation