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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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