Hello everyone,
I can get sample of data when I use the Proc Surveyselect procedure but I can just one part of sample I want to get both part of data being sample data set.
I have a sample data as below(I'm just created) When use Proc SurveySelect procedure I can get %75 of data I also want to get the remaining %25 as data set.
Can somebody help me, please?
Data Have;
Length ID 8 Target 8;
Infile Datalines Missover;
Input ID Target;
Datalines;
1 1
2 0
3 1
4 0
5 1
6 1
7 1
8 1
9 0
10 1
11 0
12 0
13 1
14 0
15 0
;
Run;
Proc Surveyselect Data=Have
Out=Want1
Method=Srs
Rate=%Sysevalf(75/100);
Run;
Thank you
yes that would work, or more compactly:
data out_75 out_25;
set want1;
if selected = 1 then output out_75;
else output out_25;
run;
If I understand your question correctly, you can use the outall option to achieve this, by writing your code as
Data Have;
Length ID 8 Target 8;
Infile Datalines Missover;
Input ID Target;
Datalines;
1 1
2 0
3 1
4 0
5 1
6 1
7 1
8 1
9 0
10 1
11 0
12 0
13 1
14 0
15 0
;
Run;
Proc Surveyselect Data=Have
Out=Want1 outall
Method=Srs
Rate=%Sysevalf(75/100);
Run;
, and then splitting up the want1 dataset by the selection indicator variable that now appears in your data 🙂
Then like this->
DATA out_75;
set Want1(where=(Selected=1));
run;
DATA out_25;
set Want1(where=(Selected=0));
run;
?
yes that would work, or more compactly:
data out_75 out_25;
set want1;
if selected = 1 then output out_75;
else output out_25;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.