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

Hello:

 

I have libname program shown as below.  I am wondering if I could assign a folder pathway after I generate the libname "RVS".  Thanks.

 

Libname RVS OLEDB 
		provider="sqloledb" 
		properties=("Data Source"="Inquire/2018"
					"Persist Security Info"="True" 
					"User ID"="test" 
					"Password"="&pin" 
					"Initial Catalog"="RVS")
		schema=dbo;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@ybz12003 wrote:

Hello:

 

I have libname program shown as below.  I am wondering if I could assign a folder pathway after I generate the libname "RVS".  Thanks.

 

Libname RVS OLEDB 
		provider="sqloledb" 
		properties=("Data Source"="Inquire/2018"
					"Persist Security Info"="True" 
					"User ID"="test" 
					"Password"="&pin" 
					"Initial Catalog"="RVS")
		schema=dbo;

You can have multiple folders in a library. Open your SAS configuration file for examples involving the SASHELP library or see if the default Key setting of CTRL-B brings up your library list to see what the path for SASHELP looks like.

 

However since libraries tend to be read and write when you use an external DB as the target for a library I suspect you would have many bad things happen if you tried to assign a path and a DB at the same time as you would be writing to two different file standards: SAS data set or DB table.

As mentioned a second libname statement would overwrite an existing libname of the same name. If that is the behavior you want go for it but expect to have issues debugging things later when looking for tables you thought were written to the DB but actually want to a different folder because the libname executed in between.

View solution in original post

6 REPLIES 6
SASKiwi
PROC Star
Spoiler
 

Please explain what you mean by "assign a folder pathway".

ybz12003
Rhodochrosite | Level 12

For example, I could like to do the following as well  after the OLEDB.

 

libname RSV 'Pathway\RSV\2018';
Reeza
Super User

You could, but it would overwrite your other library.  You could give it a different name though, but I don't  think you can combine librefs from different sources, though I haven't tried it.

 


@ybz12003 wrote:

For example, I could like to do the following as well  after the OLEDB.

 

libname RSV 'Pathway\RSV\2018';

 

SuryaKiran
Meteorite | Level 14

@ybz12003 wrote:

For example, I could like to do the following as well  after the OLEDB.

 

libname RSV 'Pathway\RSV\2018';

Is this suposed to be "RVS" or "RSV". 

 

In you initial post you mentioned "RVS" and now your assigning "RSV". If this is your situation, you can do that without any issues or if you want to assign the same name that was previously assigned, you can do that and first one will be replaced by the later one. If you want to check how that libname is defined then run LIBNAME RVS list; or you can also query sashelp.vlibnam views.

 

Thanks,
Suryakiran
ballardw
Super User

@ybz12003 wrote:

Hello:

 

I have libname program shown as below.  I am wondering if I could assign a folder pathway after I generate the libname "RVS".  Thanks.

 

Libname RVS OLEDB 
		provider="sqloledb" 
		properties=("Data Source"="Inquire/2018"
					"Persist Security Info"="True" 
					"User ID"="test" 
					"Password"="&pin" 
					"Initial Catalog"="RVS")
		schema=dbo;

You can have multiple folders in a library. Open your SAS configuration file for examples involving the SASHELP library or see if the default Key setting of CTRL-B brings up your library list to see what the path for SASHELP looks like.

 

However since libraries tend to be read and write when you use an external DB as the target for a library I suspect you would have many bad things happen if you tried to assign a path and a DB at the same time as you would be writing to two different file standards: SAS data set or DB table.

As mentioned a second libname statement would overwrite an existing libname of the same name. If that is the behavior you want go for it but expect to have issues debugging things later when looking for tables you thought were written to the DB but actually want to a different folder because the libname executed in between.

ybz12003
Rhodochrosite | Level 12

Thanks for your reply.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 6 replies
  • 848 views
  • 1 like
  • 5 in conversation