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

Hi,

 

I have created a view. and keept the view on different location. when I tried to pull the data using view. Its thrown an error and look for the base data. I am not sure why its throw such error. How to avoid such issue.

Ex: data target.a_view / view=target.a_view;

       set source.data_view;

run;

 

I am moving the view from  target.a_view to /path/a/b/c/a_view.sas7bvew. when I am trying to fetch data from a_view. its throw an error

ERROR: File source.data_view.DATA does not exist.

 

Please let me know the solution

1 ACCEPTED SOLUTION

Accepted Solutions
PravinMishra
Quartz | Level 8
Thanks a lot. for your input. I have found something on sas site which is quite helpful.

Embedding a LIBNAME in a View


You can embed a SAS LIBNAME statement or a SAS/ACCESS LIBNAME statement in a view by using the USING LIBNAME clause. When PROC SQL executes the view, the stored query assigns the libref. For SAS/ACCESS librefs, PROC SQL establishes a connection to a DBMS. The scope of the libref is local to the view and does not conflict with any identically named librefs in the SAS session. When the query finishes, the libref is disassociated. The connection to the DBMS is terminated and all data in the library becomes unavailable.
The advantage of embedded librefs is that you can store engine-host options and DBMS connection information, such as passwords, in the view. That, in turn, means that you do not have to remember and reenter that information when you want to use the libref.
Note: The USING LIBNAME clause must be the last clause in the SELECT statement. Multiple clauses can be specified, separated by commas.

View solution in original post

4 REPLIES 4
ballardw
Super User

The error message is very clean: the data set source.data_view does not exist. This could mean that the library named Source is not currently available or that the data set data_view was removed from the library.

 

Views are basically stored code. If any of the underlying data sets do not exist when the view is accessed then that code cannot perform the required actions to generate the output.

 

To avoid problems make sure that any named libraries are currently defined, that the data set(s) used in the view are actually in the library and that any variables mentioned in the view code as coming from those datasets are actually in the data sets. If the code involving variables uses anything that is varaible type dependent (numeric or character operations) the variables need to be of the appropriate type.

 

Note that if you are using Proc Import to create any of the sets used for the view you may have issues with variable type consistency.

PravinMishra
Quartz | Level 8
Hi I understand error. kept the view and data in same location. but if any third person try to access. its not working. because lib name used to define the base data not available
ballardw
Super User

If someone else is accessing the data the rule about library is the same. They have to have a library assigned pointing to the same location. No library, no view.

PravinMishra
Quartz | Level 8
Thanks a lot. for your input. I have found something on sas site which is quite helpful.

Embedding a LIBNAME in a View


You can embed a SAS LIBNAME statement or a SAS/ACCESS LIBNAME statement in a view by using the USING LIBNAME clause. When PROC SQL executes the view, the stored query assigns the libref. For SAS/ACCESS librefs, PROC SQL establishes a connection to a DBMS. The scope of the libref is local to the view and does not conflict with any identically named librefs in the SAS session. When the query finishes, the libref is disassociated. The connection to the DBMS is terminated and all data in the library becomes unavailable.
The advantage of embedded librefs is that you can store engine-host options and DBMS connection information, such as passwords, in the view. That, in turn, means that you do not have to remember and reenter that information when you want to use the libref.
Note: The USING LIBNAME clause must be the last clause in the SELECT statement. Multiple clauses can be specified, separated by commas.

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 choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1260 views
  • 0 likes
  • 2 in conversation