turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- How do I combine systematic sampling and sample ra...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-28-2016 11:12 PM

How do I solve: select only every 6th observation. sub-sample size should be 10% of original dataset size.

Below is a snippet of code for the 10% and every 6th observation. How do I combine both every 6th observation and same size of 10% using the proc surveyselect or can you?

proc surveyselect data=datain samprate=10 out=dataout;

run;

proc surveyselect data=datain method=sys (interval=6) out=dataout;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-28-2016 11:46 PM

```
proc surveyselect data=datain method=sys (interval=6) out=dataout;
run;
/* Systematic sampling gives a sampling rate of 1/6.
To achieve an overall sampling rate of 10%,
the random sampling rate should be (1/10) / (1/6) = 0.6 */
proc surveyselect data=dataout samprate=0.6 out=want;
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-28-2016 11:54 PM

fpascal wrote:

Below is a snippet of code for the 10% and every 6th observation. How do I combine both every 6th observation and same size of 10% using the proc surveyselect or can you?

You need to clarify your requirements.

Is it valid to just stack your two output datasets?

Or are you trying to combine the methodologies somehow?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-29-2016 10:40 AM

**Item 2**: Create a 10% sub-sample (find out the total number of observations in the data file and calculate 10% of this total number to determine the number of observations for your sub-sample) of the original data. Perform a Univariate statistical analysis on this sub sample for Systolic blood pressure and Diastolic blood pressure. Also, report 95% confidence interval for basic statistics.

**Item 3**: Create a sub-sample from the original dataset by selecting only every 6th observation (sub-sample size should be the same size as the sub-sample size of 10% of #2 above). Perform a Univariate statistical analysis on this sub-sample for Systolic blood pressure and Diastolic blood pressure. Also, report 95% confidence interval for basic statistics. Report the difference between #2 and #3 output.

I solved item 2 with the proc selectsurvey samprate=10 & proc univariate cibasic....

data assignment2q2;

infile'/folders/myfolders/Assignment2Dataset.txt' dlm='09'X end=eof;

input gender age systolic diastolic;

proc surveyselect data=assignment2q2 samprate=10 out=assignment2q2;

run;

proc univariate cibasic;

var systolic diastolic;

run;

**it is item 3 where it appears to combine sample rate and method (interval). My attempt is below but it is missing the 10% sample size of the original dataset**

data assignment2q3;

infile'/folders/myfolders/Assignment2Dataset.txt' dlm='09'X end=eof;

input gender age systolic diastolic;

run;

proc surveyselect data=assignment2q3 method=sys(interval=6) out=assignment2q3;

run;

proc univariate cibasic;

var systolic diastolic;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-29-2016 10:46 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-29-2016 03:10 AM

Yeah. You need give us an example to clarify your question. Sample Data and Output .

```
data have;
set sashelp.cars;
run;
%let dsid=%sysfunc(open(have));
%let nobs=%sysfunc(attrn(&dsid,nlobs));
%let dsid=%sysfunc(close(&dsid));
%let n=%sysevalf(&nobs*0.1,i);
data want;
set have;
if mod(_n_,6)=0 then do;
n+1;
if n le &n then output;
end;
drop n;
run;
```