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.

22 Using Name Literals 4 Chapter 2proc sql dquote=ansi;connect to oracle (user=testuser password=testpass);create view myview asselect "Amount Budgeted$", "Amount Spent$"from connection to oracle(select "Amount Budgeted$", "Amount Spent$"from mytable);quit;proc contents data=myview;run;Output from this example would show that Amount Budgeted$ remains AmountBudgeted$ and Amount Spent$ remains Amount Spent$.Using Name LiteralsThe following example creates a table using name literals. You must specify the <strong>SAS</strong>option VALIDVARNAME=ANY in order to use name literals. Use PROC SQL to printthe new DBMS table because name literals work only with PROC SQL and the DATAstep. PRESERVE_COLUMN_NAMES=YES is required only because the table is beingcreated with nonstandard <strong>SAS</strong> column names.options ls=64 validvarname=any nodate;libname mydblib oracle user=testuser password=testpass path=’ora8servr’preserve_col_names=yes preserve_tab_names=yes ;data mydblib.’Sample Table’n;’EmpID#’n=12345;Lname=’Chen’;’Salary in $’n=63000;proc sql;title "Sample Table";select * from mydblib.’Sample Table’n;Output 2.6DBMS Table to Test Column NamesSample TableSalaryEmpID# Lname in $-------------------------12345 Chen 63000Using DBMS Data to Create a DBMS TableThe following example uses PROC SQL to create a DBMS table based on data fromother DBMS tables. You preserve the case sensitivity of the aliased column names byusing PRESERVE_COL_NAMES=YES. A partial output is displayed after the code.libname mydblib oracle user=testuser password=testpasspath=’hrdata99’ schema=personnel preserve_col_names=yes;

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

Saved successfully!

Ooh no, something went wrong!