13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How <strong>SAS</strong>/<strong>ACCESS</strong> Works 4 How the DBLOAD Procedure Works 65because the table might have been updated by another user between procedureexecutions.)proc print data=vlib.allemp;run;proc gchart data=vlib.allemp;vbar jobcode;run;Updating DataYou use a view descriptor, DATA step, or procedure to update DBMS data in asimilar way as when you read in data. Any of these steps might also occur:3 Using the connection in<strong>for</strong>mation that is contained in the specified accessdescriptor, the <strong>SAS</strong>/<strong>ACCESS</strong> interface calls the DBMS to connect to the database.3 When rows are added to a table, <strong>SAS</strong> constructs an SQL INSERT statement andpasses it to the DBMS. When you reference a view descriptor, use the ADDcommand in FSEDIT and FSVIEW, the APPEND procedure, or an INSERTstatement in PROC SQL to add data to a DBMS table. (You can also use theEXECUTE statement <strong>for</strong> the SQL pass-through facility to add, delete, or modifyDBMS data directly. Literal values must be used when inserting data with theSQL pass-through facility.)3 When rows are deleted from a DBMS table, <strong>SAS</strong> constructs an SQL DELETEstatement and passes it to the DBMS. When you reference a view descriptor, youcan use the DELETE command in FSEDIT and FSVIEW or a DELETE statementin PROC SQL to delete rows from a DBMS table.3 When data in the rows is modified, <strong>SAS</strong> constructs an SQL UPDATE statementand passes it to the DBMS. When you reference a view descriptor, you can useFSEDIT, the MODIFY command in FSVIEW, or an INSERT statement in PROCSQL to update data in a DBMS table. You can also reference a view descriptor inthe DATA step’s UPDATE, MODIFY, and REPLACE statements.3 <strong>SAS</strong> closes the connection with the DBMS.How the DBLOAD Procedure WorksWhen you use the DBLOAD procedure to create a DBMS table, the procedure issuesdynamic SQL statements to create the table and insert data from a <strong>SAS</strong> data file,DATA step view, PROC SQL view, or view descriptor into the table.The <strong>SAS</strong>/<strong>ACCESS</strong> interface view engine completes these steps:1 When you supply the connection in<strong>for</strong>mation to PROC DBLOAD, the<strong>SAS</strong>/<strong>ACCESS</strong> interface calls the DBMS to connect to the database.2 <strong>SAS</strong> uses the in<strong>for</strong>mation that is provided by the DBLOAD procedure to construct aSELECT * FROM table-name statement, and passes the in<strong>for</strong>mation to the DBMSto determine whether the table already exists. PROC DBLOAD continues only if atable with that name does not exist, unless you use the DBLOAD APPEND option.3 <strong>SAS</strong> uses the in<strong>for</strong>mation that is provided by the DBLOAD procedure to constructan SQL CREATE TABLE statement and passes it to the DBMS.4 <strong>SAS</strong> constructs an SQL INSERT statement <strong>for</strong> the current observation and passesit to the DBMS. New INSERT statements are constructed and then executedrepeatedly until all observations from the input <strong>SAS</strong> data set are passed to the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!