BookmarkSubscribeRSS Feed
MissDemeanor
Calcite | Level 5

Hi there. I am very new to SAS, and to statistics in general (actually I have never used SAS before and I am very much stuck, it took me a whole day just to figure out how to run the program and print out each line in the dataset). I have a dataset about lifestyle and health of the population of a country. The survey was conducted using a stratified clustered multistage design. I have to take a 30% sample from this and perform some descriptive statistical analysis. Each individual in the dataset has a weight assigned (this is because some provinces were over represented while others were under represented and also because different members in ahousehold had different probabilities of being selected). When I take my sample, do I take a simple random sample, and then include the weights afterwards when I calculate the means and the variance and so on? Or do I take the weights into account while I select the sample (so that I don't take too many individuals from over represented provinces)? What would the SAS code look like?

I really appreciate your feedback

1 REPLY 1
PGStats
Opal | Level 21

If I understand the sampling plan correctly then you should be subsampling clusters (households) within strata (provinces, etc.). The analysis could look something like this:

/* Subsample 30% of clusters (households).

Extracts a subsample in dataset subStudy, adds variable SelectionProb */

proc surveySelect data=originalStudy out=subStudy rate=0.3;
strata Province;
cluster HouseholdID; /* identifies a household within a province */
run;

/* Multiply original selection probabilities by subsampling probabilities

to create new weights */

data subWeightedStudy;
set subStudy;
newWeight = originalWeight * SelectionProb;
run;

/* Estimate means and rates.

Households is an optional input dataset that  gives the total number of

clusters (households) (in variable named _TOTAL_) per stratum (province) */

proc surveyMeans data=subWeightedStudy total=Households;

class LifeStyleClass;
strata Province;
cluster HouseholdID;
weight newWeight;
var LifeStyleClass HealthVar; /* Estimate LifeStyleClass rates and HealthVar mean */
run;

SAS documentation contains a simple example of a stratified cluster sampling design analysis :

http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_surveymeans_...

PG

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 718 views
  • 0 likes
  • 2 in conversation