BookmarkSubscribeRSS Feed
RahulG
Barite | Level 11

Libname Test1 (C:\t1, C:\t2, C:\t3);

 

 

Filename Test2 (C:\t1, C:\t2, C:\t3);

 

 

Ques 1- In Libname, If all three folder do not exist then Libname gives WARNING but for filename there is no such warning generated. Why?

 

Ques 2- For libname/Filename, if member exists in multiple folder then which member would be refferred ? Example - Data1.sas7bdat with different columns exists in t1 and t2 folder then which Data1 would come in libname. I think it will take from t1 folder as it is written first. Please confirm whether order of folder name matters? Is the same concept applies on Filename.

 

 

3 REPLIES 3
Reeza
Super User

Q1. You can use a filename to create a file, in this case it doesn't need to preexist to create a file.

 

I don't know the answer to Q2

 

 

Kurt_Bremser
Super User

Since a filename can be used to create a new file, SAS doesn't complain if no file is present at the time you define the file reference.

A library must be present at the time the libname is executed.

If you want to create new files/datasets, spanned definitions are a BAD IDEA. Don't do it.

And if you're not sure what is where, don't use them either. Be specific.

 

- Computers are dumb ("Computer sind doof" - Spliff, 1984)

Tim_SAS
Barite | Level 11

Q2 is easy enough to test. What is the output from this program?

 

libname t1 "C:\t1";
libname t2 "C:\t2";
data t1.test;
	x = 'This is the data set in T1';
data t2.test;
	x = 'This is the data set in T2';
libname both ("C:\t1" "C:\t2");
title 'T1 is first';
proc print data=both.test;
run;
libname both clear;
libname both ("C:\t2" "C:\t1");
title 'T2 is first';
proc print data=both.test;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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