Professional Documents
Culture Documents
Creating Macro Variables With Proc SQL
Creating Macro Variables With Proc SQL
reports
PROC SQL tables (SAS data files) SAS data views (PROC SQL views) (DATA step views) (SAS/ACCESS views)
PROC SQL
DBMS tables
DBMS tables
Macro Facility
Gerald Frey 2997 Yarmouth Greenway Drive Madison, WI 53711 (608) 278-9964 www.sys-seminar.com
45
Introduction
Quite often we need to: Read data into a data step Use Call SYMPUT to create macro variables Use those macro variables in a macro loop.
46
47
Log
The First ER Visit on Record was treated by White
48
PROC SQL options; SELECT column(s) FROM table-name | view-name WHERE expression GROUP BY column(s) HAVING expression ORDER BY column(s)
49
50
51
proc tabulate data=ervisits; title "The following Providers are "; title2 "Included in the Summary Info:"; title3 "&docs"; var charged; tables charged*f=dollar10.2*mean; run;
Systems Seminar Consultants, Inc. 52
The following Providers are Included in the Summary Info: White, Smith, White, Jones, Smith, Jones charged Mean $532.83
53
proc tabulate data=ervisits; title "The following Providers are "; title2 "Included in the Summary Info:"; title3 "&docs"; var charged; tables charged*f=dollar10.2*mean; run;
Systems Seminar Consultants, Inc. 54
The following Providers are Included in the Summary Info: Jones, Smith, White charged Mean $532.83
55
56
57
LOG
378 proc sql; 379 create table allclms as 380 select * 381 from claims 382 where doctor in (&docs); SYMBOLGEN: Macro variable DOCS resolves to 'Jones ', 'Smith ', 'White '
Systems Seminar Consultants, Inc. 58
$1,234 $105
59
60
numrows=3
62
63
64
";
";
";
65
67
68