📄 sqlcreat.sas
字号:
/****************************************************************/ /* S A S S A M P L E L I B R A R Y */ /* */ /* NAME: SQLCREAT */ /* TITLE: DEMONSTRATES BASIC SQL CREATE STATEMENTS */ /* PRODUCT: BASE */ /* SYSTEM: ALL */ /* KEYS: SQL CREATE TABLE SELECT WHERE */ /* PROCS: SQL */ /* DATA: */ /* */ /* SUPPORT: KMS, PMK UPDATE: */ /* REF: */ /* MISC: */ /* */ /****************************************************************/ title1 '*** sqlcreat: basic SQL create statements ***'; /*---------------------------------------------------------------*/ /*-- The first step is to create the Paper table which will be --*/ /*-- used in the following queries. --*/ /*---------------------------------------------------------------*/data paper; input author$1-8 section$9-16 title$17-43 @45 time time5. duration; format time time5.; label title='Paper Title'; cards;Tom Testing Automated Product Testing 9:00 35Jerry Testing Involving Users 9:50 30Nick Testing Plan to test, test to plan 10:30 20Peter Info SysArtificial Intelligence 9:30 45Paul Info SysQuery Languages 10:30 40Lewis Info SysQuery Optimisers 15:30 25Jonas Users Starting a Local User Group 14:30 35Jim Users Keeping power users happy 15:15 20Janet Users Keeping everyone informed 15:45 30Marti GraphicsMulti-dimensional graphics 16:30 35Marge GraphicsMake your own point! 15:10 35Mike GraphicsMaking do without color 15:50 15Jane GraphicsPrimary colors, use em! 16:15 25;proc sql; /*---------------------------------------------------------------*/ /*-- SQL can create SAS datasets in three ways. --*/ /*-- --*/ /*-- 1) as an empty copy of some other table --*/ /*-- 2) as the results of any valid SQL select expression --*/ /*-- 3) from the traditional SQL DML statements --*/ /*-- --*/ /*---------------------------------------------------------------*/ /*---------------------------------------------------------------*/ /*-- This creates table P2, and empty copy of PAPER --*/ /*---------------------------------------------------------------*/ create table p2 like paper; /*---------------------------------------------------------------*/ /*-- In one step, this creates a table, P3, that contains all --*/ /*-- of the papers presented after 12:00. --*/ /*---------------------------------------------------------------*/ create table p3 as select * from paper where time > '12:00't; /*---------------------------------------------------------------*/ /*-- This creates a table, unlike any existing table. --*/ /*---------------------------------------------------------------*/ create table counts( section char(20), papers num );quit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -