-1

I'm completely new to SAS Studio. I have a text file including SQL create statements and insert statements of a database, I need to import all data from this document to SAS studio to run the queries in asked in my assignment. Part of my document looks:

create table Aschema.JOB(
JOB_ID num,
JOB_DESCRIPTION varchar(30),
JOB_CHARG_HOUR num(4,2),
constraint pkjob1 primary key (JOB_ID)
);

insert into Aschema.job
values (500,'Programmer',35.75)
values (502,'Database Designer',105.00)
values (505,'Civil Engineer',55.78)
values (507,'DSS Analyst',45.95)
values (504,'Mechanical Engineer',67.90);

I'm using the online one:

https://odamid-apse1.oda.sas.com/SASODAControlCenter/

First I need to create a new library, then import this file to SAS studio. Your help is highly appreciated.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
  • Are you trying to use that SQL code to create SAS datasets? Or pass it to some remote database system where it makes sense to try to use features like `CONSTRAINT` and data types like `NUM(4,2)`? Is the code too long to just open it in the program editor? – Tom May 22 '20 at 13:04

1 Answers1

0

Create a libname and then wrap your code in PROC SQL. This was tested on SAS Academics on Demand and worked.

libname mylib '/home/xxxxxx/Sample';

proc sql;
create table mylib.JOB(
JOB_ID num,
JOB_DESCRIPTION varchar(30),
JOB_CHARG_HOUR num(4,2),
constraint pkjob1 primary key (JOB_ID)
);

insert into mylib.job
values (500,'Programmer',35.75)
values (502,'Database Designer',105.00)
values (505,'Civil Engineer',55.78)
values (507,'DSS Analyst',45.95)
values (504,'Mechanical Engineer',67.90);

quit;
Reeza
  • 20,510
  • 4
  • 21
  • 38