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.

The CV2VIEW Procedure 4 Example 1: Converting an Individual View Descriptor 887run;PROC CV2VIEW generates these PROC SQL statements./* SOURCE DESCRIPTOR: MYVIEW */PROC SQL DQUOTE=ANSI;CREATE VIEW OUTPUT.NEWVIEW(/* READ= *//* WRITE= *//* ALTER= */LABEL=EMPLINFO)AS SELECT"EMPLOYEE " AS EMPLOYEE INFORMAT= 5.0 FORMAT= 5.0LABEL= ’EMPLOYEE ’ ,"LASTNAME " AS LASTNAME INFORMAT= $10. FORMAT= $10.LABEL= ’LASTNAME ’ ,"SEX " AS SEX INFORMAT= $6. FORMAT= $6.LABEL= ’SEX ’ ,"STATUS " AS STATUS INFORMAT= $9. FORMAT= $9.LABEL= ’STATUS ’ ,"DEPARTMENT" AS DEPARTME INFORMAT= 7.0 FORMAT= 7.0LABEL= ’DEPARTMENT’ ,"CITYSTATE " AS CITYSTAT INFORMAT= $15. FORMAT= $15.LABEL= ’CITYSTATE ’FROM _CVLIB_."EMPLINFO"USING LIBNAME _CVLIB_Oracle/* PW= */USER=ordevxx PATH=OracleV8 PRESERVE_TAB_NAMES=YES;QUIT;The REPLACE FILE statement causes an existing file named SQL.<strong>SAS</strong> to beoverwritten. Without this statement, the text would be appended to SQL.<strong>SAS</strong> if theuser has the appropriate privileges.The LABEL value of EMPLINFO is the name of the underlying database table that isreferenced by the view descriptor.If the underlying DBMS is Oracle or DB2, the CV2VIEW procedure adds thePRESERVE_TAB_NAMES= option to the embedded LIBNAME statement. You can thenuse CV2VIEW to access those tables with mixed-case or embedded-blank table names.Note: This SQL syntax fails if you try to submit it because the PW field of theLIBNAME statement is replaced with a comment in order to protect the password. TheALTER, READ, and WRITE protection is commented out <strong>for</strong> the same reason. You canadd the passwords to the code and then submit the SQL to re-create the view. 4

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

Saved successfully!

Ooh no, something went wrong!