Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

Using SQL in SAS with Multiple Dataset Locations

I am trying to run the attached SAS program using SQL in my company's system, but I continue to have the same error.  I though it would be a simple LEFT JOIN, but I assume the two different dataset locations are the problem.  

I would appreciate any help you can provide.

Thank you very much.

George
SAS-Problem.txt
0
gwflyer
Asked:
gwflyer
1 Solution
 
ShannonEECommented:
Hi there  gwflyer,

Is this homework?  It may be so that I wont be providing actual code to make it work, but rather point out the problems you are probably having in understanding how sas works.

If this is not homework I am allowed to help further. In any case what I say below should be enough to get you going.

The problem is most likely with your libname statements and with your specification of the data set (table) that you want to read.  I say that because the log you supplied says that
File WORK.MYEMPLOYEE.DATA does not exist

The first table that the code (as currently written) is looking for is
dataset MYEMPLOYEE
in library WORK
of type DATA.

As you have used it, the libname statement needs to point to a folder which can contain 1 or more datasets. The datasets typically have operating system file names  like  "employeeHours.sas7bdat", but are referred with a SAS dataset name of employeeHours. Hence there should be files in your system with full path names of
/pdq/pub/employee/*.sas7bdat

To refer to a dataset in a particular library use the syntax <library>.<dataset>. Any dataset within SAS code without a preceding library name followed by a dot, are in the temporary library called WORK.  Hence
empdata
and
work.empdata
both refer to to same dataset.

===

First make sure that the libname statement points to a folder and not to the individual dataset.

Next in the SQL from clause use a double barrel name of  <library name>.<sas dataset>.

Hope this is enough to get along.

Ian
0
 
gwflyerAuthor Commented:
Thank you very much.  This is a work-related problem and your guidance put me in the right direction.  You were exactly right and my program ran successfully.  I really appreciate the time you took to explain it in detail.   Thanks again.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now