1. Remember that PROC SQL options are specified in the PROC SQL statement
2. After you specify an option, it remains in effect until you change it or you re-invoke
PROC SQL.
3.
4.proc sql inobs = 5; means only read 5 rows from each table specified in the query.
5. proc sql number; list a column in the output, which is the row number. number and nonumber is like obs | noobs in print precedure.
6. proc sql double; or nodouble; means double space, do not affect HTML output.
7. flow | noflow | flow=n | flow= n m 其实就是让每一列的内容自动换行,这样的话就不会让最后几列窜到前几列去。 对list output 有用, 对HTML pdf rtf 没用。n和m 是行宽度的范围。
8. STIMER | NOSTIMER option is showing the time for each SELECT statement. in order to use stimer | nostimer in proc sql. we have to make sure the stimer option in SAS system option is in effect by checking
proc options option = stimer value; run;
stimer | nostimer show time after the QUIT; statement.
9 RESET optionname; just add or reset other options. not affect other pre-set options.
10. Dictionary tables. created each time they are referenced in a SAS program; updated automatically; limited to read-only access.
11. proc sql;
select memname
from dictionary.columns
where libname=’SASUSER’ 先使用 describe table dictionaryname 去看这个dictionary里面有什么,然后用这个query来选择和加条件。
12. 我感觉dictionary table 就是把某一个library下面各个数据的属性的一个集合,放到一个特殊的文件里。
13. LOOPS = option 限制的proc sql 的inner loop 的次数。 可以用 PROMPT | NOPROMPT来 选择达到最大loop次数的时候,继续不继续。
14. EXEC | NOEXEC 先是check 命令的准确性,如果用exec,没错误了就继续执行命令。
15. 在exec in effect 时, 用 ERRORSTOP | NOERRORSTOP 去让SAS 遇到错误停不停。
16.After you specify an option, it remains in effect until you change it or you
re-invoke PROC SQL.
The DOUBLE | NODOUBLE and the FLOW | NOFLOW | FLOW=n| FLOW=n
m options do not affect the appearance of HTML, PDF, or RTF output that is
created with the Output Delivery System.
If you query a Dictionary table about the files in a specific library, the library
name used in the WHERE clause must be specified in uppercase letters because
that is how it is stored in SAS. Column names used in the WHERE clause must be
specified in the same case as they appear in the Dictionary table.
QUIZ:
1. a
2. b
3. c
4. d
5. d
6. d
7. d
8.d
9. b
10. b-----a
CH9Introducing Macro Variables
1. There are two types of macro variables:
automatic macro variables, which are provided by SAS
user-defined macro variables, whose values you create and define.
2. If you need to reference a macro variable within quotation
marks, such as in a title, you must use double quotation marks. The macro processor
will not resolve macro variable references that appear within single quotation marks.
3. When you use the %LET statement to define macro variables, you should keep in
mind the following rules:
All values are stored as character strings.
Mathematical expressions are not evaluated.
The case of the value is preserved.
Quotation marks that enclose literals are stored as part of the value.
Leading and trailing blanks are removed from the value before the assignment is
made.
4. A SAS program can be any combination of
DATA steps and PROC steps
global statements
SAS Component Language (SCL) code
Structured Query Language (SQL) code
SAS macro language code.
5.
General form, OPTIONS statement with SYMBOLGEN option:
OPTIONS NOSYMBOLGEN | SYMBOLGEN;
where
NOSYMBOLGEN
specifies that log messages about macro variable references will not be displayed. This is the
default.
SYMBOLGEN
specifies that log messages about macro variable references will be displayed.
6. 用 %put 后面加各种文字或者Macro variables, 先是macro variable的值。 也可以用%put _all_ 显示所有macro variable。或者%put _automatic_ 或者 _user_
7. 档Macro variable里面有特殊的符号,你不想让SAS 误会的话,就用 %STR
eg: %let prog=%str(data new; x=1; run;);
%let prog=data new%str(;) x=1%str(;)run%str(;);
如果macro variable 里面有单引号的话,要在前面加%, 例如:
%let text=%str(Joan%’s Report);
%let text=Joan%str(%’)s Report; 这两个的结果都是 Joan's Report
如果要把&和%也当做constant的话, 就要用 %nrstr(). eg: %let Period=%nrstr(May&Jun);
8.
%let text=%bquote(Joan’s Report); 直接就行。也有%NRBQUOTE;
9.
%qupcase()直接对于特殊符号不作变动。
10.
%qsubstr 不会编译解释特殊符号
11. The %INDEX function
searches source for the first occurrence of string
returns a number representing the position in source of the first character of string
when there is an exact pattern match
returns 0 when there is no pattern match.
e.g.: %index(&a, v) look for the first position of v in &a.
12.
%qscan() 不会编译解释特殊符号。
13.
14.The LEFT function expects only one argument, but you are passing “June 7, 2007” to
it. It interprets the comma as the delimiter between two arguments.
You can mask the comma by using the %QSYSFUNC function instead, as follows:
title "Report Produced on
%sysfunc(left(%qsysfunc(today(),worddate.)))";
The modified statement generates the following title:
Report Produced on June 7, 2007
15. 如果macrovariable 和别的字母连起来了让SAS分辨不出来了,就用一个点(.) 来分离。那个店在编译结束后不会出现。
16.
17. If you reference a macro variable within quotation marks, you must use double
quotation marks. Macro variable references that are enclosed in single quotation
marks will not be resolved.
QUIZ:
1. b
2. c
3. a
4. d
5. d 如果macro variable里有太多的空格,SAS只留一个空格。
6. d
7. c
8. d --------b
9. c
10. c
没有评论:
发表评论