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

Hi all:

 

I have codes below.  I would like to assign Surv10 in SURV folder, Pneulab in LAB folder and Vax10 in VAX folder into one new folder RDB.   I am curious if there is a better way to do it.  Thanks.

 

libname RDBlab "Pathway\data\lab";
libname RDBsurv "Pathway\data\surv";
libname RDBvax "Pathway\data\vax";
libname RDB "Pathway\data";

data RDB.SURV10; set RDBsurv.SURV10; run;
data RDB.PNEULAB; set RDBlab.PNEULAB; run;
data RDB.VAX10; set RDBvax.VAX10; run;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You can refer to these table if their table name is unique.

 

libname RDB ( "Pathway\data\lab" "Pathway\data\surv" "Pathway\data\vax" );

data x;
 set RDB.SURV10;
run;

View solution in original post

6 REPLIES 6
Reeza
Super User
PROC DATASETS or PROC COPY.
ybz12003
Rhodochrosite | Level 12

Hi Reeza:

 

I used PROC COPY, but really didn't see any simpler than mines.  

 

proc copy out=RDB in=RDBlab memtype=data;
	select PNEULAB;
run;

proc copy out=RDB in=RDBsurv memtype=data;
	select SURV10;
run;

proc copy out=RDB in=RDBvax memtype=data;
	select VAX10;
run;
Reeza
Super User

@ybz12003 when you use a data step SAS copies the data line by line, in case you have any calculations/manipulations. 

However, when you use PROC COPY, it copies the data over in blocks instead of a line at a time. For a large data set this has significant time savings, but for smaller tables you may not see an improvement. 

 

I don't think this is any simpler but it seems a bit more clean to me. 

 

proc datasets lib=work;
copy in=sashelp out=work; *from sashelp to work;
select class;
copy in=sasuser out=work; *from sasuser to work;
select funcs;
run;quit;
ybz12003
Rhodochrosite | Level 12

Oh, I don't know that.  Thanks for the clarification.

Ksharp
Super User

You can refer to these table if their table name is unique.

 

libname RDB ( "Pathway\data\lab" "Pathway\data\surv" "Pathway\data\vax" );

data x;
 set RDB.SURV10;
run;
ybz12003
Rhodochrosite | Level 12

Thanks, Kshap.  That's awesome! Smiley Happy

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1716 views
  • 0 likes
  • 3 in conversation