Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

view creation error?

Accepted Solution Solved
Reply
Contributor
Posts: 60
Accepted Solution

view creation error?

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


Accepted Solutions
Solution
‎08-04-2016 04:19 PM
Contributor
Posts: 60

Re: view creation error?

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


All Replies
Super User
Posts: 11,343

Re: view creation error?

Posted in reply to PravinMishra

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.

Contributor
Posts: 60

Re: view creation error?

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
Super User
Posts: 11,343

Re: view creation error?

Posted in reply to PravinMishra

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.

Solution
‎08-04-2016 04:19 PM
Contributor
Posts: 60

Re: view creation error?

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.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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