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 (February 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 27 Feb 2008 12:34:42 -0800
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Weird error
In-Reply-To:  <03bf3ec7-7400-47b2-8265-455fce91a649@62g2000hsn.googlegroups.com>
Content-Type: text/plain; charset=iso-8859-1

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of Reeza > Sent: Wednesday, February 27, 2008 10:41 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Weird error > > On Feb 27, 9:58 am, program....@GMAIL.COM (Jane) wrote: > > I read a data table from Oracle database > > > > When I use the following code: > > > > data test; > > set abc.have; > > run; > > > > Then SAS gave an error message: > > ERROR: Invalid sequence of commands for file abc.have.DATA. > > > > But when I use the following code: > > > > proc sql; > > create table test as > > select * > > from abc.have; > > quit; > > > > Then everything is fine. > > > > Does anyone have any idea about this error? > > > > Thanks > > Jane > > Are you pulling a column or dataset? > > Assuming sql is correct 'abc' is your dataset and 'have' is a > column.... In SAS the appropriate code would be > data need; > set abc; > keep have; > run; > No, that is not correct. In SAS Proc SQL, 'abc' would a libname reference (using the Oracle or ODBC engine) to the Oracle database, and 'have' is a table in the database. Both the data step and the proc sql are correctly specified, as long as the libname is set up correctly and the table exists in the database.

I would be looking for something more along the lines of the link that Arthur Tabachneck posted to this thread. There are differences between what can be done in a data step and what can be done in Proc SQL. For example, I don't believe you can write to the Oracle database using a data step. You need to use Proc SQL (at least that has been my experience). However, the data step syntax above is fundamentally sound, and is what I often use to read Oracle tables.

Sorry I can't be of more help,

Dan

Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204


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