LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 19 Dec 2005 21:48:14 -0800
Reply-To:     David L Cassell <davidlcassell@MSN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         David L Cassell <davidlcassell@MSN.COM>
Subject:      Re: Proc SQL - referencing a library
In-Reply-To:  <200512200527.jBK5QcTk008883@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed

SAS_L@LISTSERV.EDU.AU wrote: >My undersatnding (limited) is that in PROC SQL, "a.var," can refer to the >variable called var in the dataset called a. What if the dataset called a >is >in a library called "lib"? "lib.a.var" wont work (too many periods) - how >do >I reference variable var in dataset a in library lib in Proc SQL?

Don't make things so hard. Take PROC SQL (and SQL in general) a line at a time. First, make a table alias. So you have Var1 in data set lib.barf . Make a table alias in the FROM component, and use that:

proc sql; select a.Var1 from lib.barf as a; quit;

But if you only have *one* data set, then you don't even have to work this hard.

proc sql; select Var1 from lib.barf; quit;

It's when you need to refer more than one data set that the table aliases become convenient.

HTH, David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330

_________________________________________________________________ Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


Back to: Top of message | Previous page | Main SAS-L page