Managing Processing Using PROC SQL Chapter 8 1 Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS INOBS= INOBS= –Used to restrict the number of input rows –Useful for possibly large queries (e.g., outer unions) proc sql inobs=5; select * from Ecoli outer union corr select * from Fcoli outer union corr select * from Entero; quit; 2Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS OUTOBS= OUTOBS= –Used to restrict the number of output rows –OUTOBS= by itself restores the default (all rows output) 3Imelda Go, John Grego, Jennifer Lasecki, 2011
Example: OUTOBS proc sql outobs=5; select player, atbats select player, atbats from bbstats; from bbstats;quit; playeratbats Christian Walker271 Scott Wingo240 Brady Thomas231 Evan Marzilli220 Robert Beary211 4Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS DOUBLE/NODOUBLE DOUBLE/NODOUBLE –specifies whether output is double spaced –this option does not affect the appearance of HTML output proc sql outobs=5 double; select player, atbats select player, atbats from bbstats; from bbstats;quit; 5Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS NUMBER/NONUMBER NUMBER/NONUMBER –Adds or removes row numbers from a table –The column is labeled: Row –Similar to OBS/NOOBS in PROC PRINT proc sql outobs=5 double number; select player, atbats select player, atbats from bbstats; from bbstats;quit; 6Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS FLOW | NOFLOW FLOW=n | FLOW=n m –Controls appearance of wide character columns in listing output –n sets the width of the flowed column –Specifying n and m floats the width of the column between limits –does not affect the appearance of HTML, PDF, or RTF output 7Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS Example of FLOW proc sql flow = double; select winner.wscore label="Matching Score", winner.date format=worddate18. label="Date", winner.wteam label="Team with Winning Score", loser.date format=worddate18. label="Date", loser.lteam label="Team with Losing Score" from secscores as winner, secscores as loser where winner.wscore=loser.lscore; quit; 8Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS RESET can be used to change OUTOBS=, NUMBER, NODOUBLE, NOFLOW, etc It can be inserted between SELECT clauses to restore options 9Imelda Go, John Grego, Jennifer Lasecki, 2011
PROC SQL OPTIONS Example of RESET proc sql outobs=6 double; select player, atbats from bbstats; reset outobs= number nodouble; select player, hits from bbstats; quit; 10Imelda Go, John Grego, Jennifer Lasecki, 2011
Timing Information When learning about indexes in Chapter 6, we used the default timing information available in the SAS Log Timing info can be disaggregated by task using the STIMER option Additional task info can be obtained using FULLSTIMER Both methods are useful for benchmarking Imelda Go, John Grego, Jennifer Lasecki,
Timing Information If CPU Time is close to Real Time, than the system is operating efficiently In addition to Real Time and CPU Time, FULLSTIMER provides data on -Memory -Involuntary CPU time-slice releases -Page swaps Imelda Go, John Grego, Jennifer Lasecki,
Dictionaries DICTIONARY.TABLES contains meta data about tables and views DICTIONARY.COLUMNS contains meta data about columns in tables Can be compared to PROC CONTENTS Imelda Go, John Grego, Jennifer Lasecki,
Dictionaries To find what variables are available, use DESCRIBE TABLE A specific query proc sql; select memname, memtype, nobs, nvar, num_character, num_numeric, filesize, crdate from dictionary.tables where libname='WORK'; quit; Imelda Go, John Grego, Jennifer Lasecki,