Solved

Using SQL in SAS with Multiple Dataset Locations

Posted on 2013-06-13
2
400 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
2 Comments
 
LVL 8

Accepted Solution

by:
ShannonEE earned 500 total points
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now