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
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 718 views
  • 0 likes
  • 3 in conversation