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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

830 Determining Format Publish Dates 4 Chapter 28Note: If you explicitly use the <strong>SAS</strong>_PUT( ) function in your code, it is recommendedthat you use double quotation marks around a column name to avoid any ambiguitywith the keywords. For example, if you did not use double quotation marks around thecolumn name, DATE, in this example, all date values would be returned as today’s date.4select distinctcast(sas_put("price", ’dollar8.2’) as char(8)) as "price_c",cast(sas_put("date", ’date9.1’) as char(9)) as "date_d",cast(sas_put("inv", ’best8.’) as char(8)) as "inv_n",cast(sas_put("name", ’$32.’) as char(32)) as "name_n"from mailorderdemo;Tips When Using the <strong>SAS</strong>_PUT( ) Function3 When <strong>SAS</strong> parses the PUT function, <strong>SAS</strong> checks to make sure that the <strong>for</strong>mat is aknown <strong>for</strong>mat name. <strong>SAS</strong> looks <strong>for</strong> the <strong>for</strong>mat in the set of <strong>for</strong>mats that aredefined in the scope of the current <strong>SAS</strong> session. If the <strong>for</strong>mat name is not definedin the context of the current <strong>SAS</strong> session, the <strong>SAS</strong>_PUT( ) function is returned tothe local <strong>SAS</strong> session <strong>for</strong> processing.3 To turn off automatic translation of the PUT function to the <strong>SAS</strong>_PUT( ) function,set the SQLMAPPUTTO= system option to NONE.3 The <strong>for</strong>mat of the <strong>SAS</strong>_PUT( ) function parallels that of the PUT function:<strong>SAS</strong>_PUT(source, ’<strong>for</strong>mat.’)3 Using both the SQLREDUCEPUT= system option (or the PROC SQLREDUCEPUT= option) and SQLMAPPUTTO= can result in a significantper<strong>for</strong>mance boost. First, SQLREDUCEPUT= works to reduce as many PUTfunctions as possible. Then you can map the remaining PUT functions to<strong>SAS</strong>_PUT( ) functions, by setting SQLMAPPUTTO= <strong>SAS</strong>_PUT.3 Format widths greater than 256 can cause unexpected or unsuccessful behavior.3 If a variable is associated with a $HEXw. <strong>for</strong>mat, <strong>SAS</strong>/<strong>ACCESS</strong> creates the DBMStable, and the PUT function is being mapped to the <strong>SAS</strong>_PUT( )function,<strong>SAS</strong>/<strong>ACCESS</strong> assumes that variable is binary and assigns a data type of BYTE tothat column. The <strong>SAS</strong>_PUT( ) function does not support the BYTE data type.Teradata reports an error that the <strong>SAS</strong>_PUT( ) function is not found instead ofreporting that an incorrect data type was passed to the function. To avoid thiserror, variables that are processed by the <strong>SAS</strong>_PUT( ) function implicitly shouldnot have the $HEXw. <strong>for</strong>mat associated with them. For more in<strong>for</strong>mation, see“Data Types and the <strong>SAS</strong>_PUT( ) Function” on page 819.If you use the $HEXw. <strong>for</strong>mat in an explicit <strong>SAS</strong>_PUT( ) function call, this errordoes not occur.3 If you use the $HEXw. <strong>for</strong>mat in an explicit <strong>SAS</strong>_PUT( ) function call, blanks inthe variable are converted to “20” but trailing blanks, that is blanks that occurwhen using a <strong>for</strong>mat width greater than the variable width, are trimmed. Forexample, the value “A ”(“A” with a single blank) with a $HEX4. <strong>for</strong>mat is writtenas 4120. The value “A” (“A” with no blanks) with a $HEX4. <strong>for</strong>mat is written as41 with no blanks.Determining Format Publish DatesYou might need to know when user-defined <strong>for</strong>mats or <strong>for</strong>mats that <strong>SAS</strong> supplieswere published. <strong>SAS</strong> supplies two special <strong>for</strong>mats that return a datetime value thatindicates when this occurred.

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

Saved successfully!

Ooh no, something went wrong!