'Convert' .sql File Into SAS Data Tables

Reply
N/A
Posts: 1

'Convert' .sql File Into SAS Data Tables

Hi,


Essentially what I have is a .sql file that contains information about a database. This database is supposed to have exactly 8 tables in it.


All I want to do is to output the contents (tables) of this .sql file into 8 .sas7bdat files so I am able to create a library within SAS and query each of these 8 tables. Is this possible?


I hope this makes sense and I'm sorry for my lack of database knowledg

SAS Employee
Posts: 340

Re: 'Convert' .sql File Into SAS Data Tables

Most probably it is an SQL dump. It contains essentially SQL statements (create table, insert into...).

If you put the contents of the file inside a PROC SQL;   and   QUIT;   you have some chances that you can run it.

But also possible, that you have to edit this code.

A "supported way" to import such a file is to import it with a native tool (Oracle and maybe MySQL and PostgreSQL support this), then access that database with the appropriate SAS Access engine. Or make an export to a text file.

Super User
Posts: 9,874

Re: 'Convert' .sql File Into SAS Data Tables

What form of your original data is it ? TEXT CSV files ?

If so , you need sophisticated SAS Programming skill to transform these SQL statement into SAS Data Step . Like something :

data stock;

infile 'c:\temp\a.csv' dsd truncover;

input sid : $20. price tran_date : yymmdd10.;

run;

Xia Keshan

Super User
Posts: 7,445

Re: 'Convert' .sql File Into SAS Data Tables

I think he's got SQL source that creates tables from code, much like a data step with cards;

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 888 views
  • 0 likes
  • 4 in conversation