Solved

Using SQL in SAS with Multiple Dataset Locations

Posted on 2013-06-13
2
416 Views
Last Modified: 2013-06-14
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
Comment
Question by:gwflyer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
ShannonEE earned 500 total points
ID: 39246412
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
 

Author Closing Comment

by:gwflyer
ID: 39248443
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Simple Linear Regression

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question