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

Hi,

 

I am currently working on a school project and I am stuck in the step where I need to save in a permanent library my sampled data. I know how to create one using a libname, but you usually do that at the beginning, right? Is there a way to do it after sampling (because I only want to save my sampled data)?  Below is my sas code for your reference.

 

Thanks, in advance, SAS community!

 

Best,

 

Art

 

Filename F1 'C:\Users\among\OneDrive\Desktop\Study1_1.txt';
data study1;
infile F1;
infile F1 dsd dlm=',';
infile F1 missover;
input Patient_ID Age State $ Length_of_Stay Total_Charge;
run;
proc print data=study1;
run;


Filename F2 'C:\Users\among\OneDrive\Desktop\Study2_2.txt';
data study2;
infile F2;
infile F2 dsd dlm=',';
infile F2 missover;
input Patient_ID Group $ Test_Score;
run;
proc print data=study2;
run;


proc sort data=study1;
by Patient_ID;
run;
proc sort data=study2;
by Patient_ID;
run;
data final;
merge study1 study2;
by Patient_ID;
run;
proc print data=final;
run;


proc surveyselect
data=final
method=srs
sampsize=1000
out=final_sample
;
run;
proc print data=final_sample;
run;

--stuck here-- <how to save my sampled data?>



 

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

HI @aongkeko ,

 

You can define a libname at the beginning of your code to specify the location :

eg.: 

libname mylib "<physical path>";

and then mention this libname in your code in the proc surveyselect:

out=mylib.final_sample  

 

View solution in original post

3 REPLIES 3
ed_sas_member
Meteorite | Level 14

HI @aongkeko ,

 

You can define a libname at the beginning of your code to specify the location :

eg.: 

libname mylib "<physical path>";

and then mention this libname in your code in the proc surveyselect:

out=mylib.final_sample  

 

aongkeko
Calcite | Level 5

It worked! Thanks very much!

ed_sas_member
Meteorite | Level 14

You're welcome Smiley Happy!