-
Notifications
You must be signed in to change notification settings - Fork 0
/
week14_2.sas
74 lines (61 loc) · 1.58 KB
/
week14_2.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*0619-parameter validation*/
%macro customers(place);
%let place = %upcase(&place);
%if &place=AU
or &place=CA
or &place=DE
or &place=IL
or &place=TR
or &place=US
or &place=ZA %then %do;
proc print data=orion.customer;
var customer_name customer_address country;
where upcase(country)="&place";
title "Customers from &place";
run;
%end;
%else %put Sorry, no customers from &place..;
%mend customers;
options mprint mlogic;
%customers(de)
%customers(au)
%customers(aa)
options nomprint nomlogic;
/*or ¹Ýº¹-> in */
%macro customers(place)/ minoperator;
%let place = %upcase(&place);
%if &place in AU CA DE IL TR US ZA %then %do;
proc print data=orion.customer;
var customer_name customer_address country;
where upcase(country)="&place";
title "Customers from &place";
run;
%end;
%else %put Sorry, no customers from &place..;
%mend customers;
options mprint mlogic;
%customers(de)
%customers(au)
%customers(aa)
/*sql °á°ú macro variable list ¾È¿¡ ³Ö±â*/
%macro customers(place)/ minoperator;
%let place = %upcase(&place);
proc sql noprint;
select distinct country into :list separated by ' '
from orion.customer;
quit;
%if &place in &list %then %do;
proc print data=orion.customer;
var customer_name customer_address country;
where upcase(country)="&place";
title "Customers from &place";
run;
%end;
%else %do;
%put Sorry, no customers from &place..;
%put Valid countries are: &list..;
%end;
%mend customers;
%put &list;
%customers(de)
%customers(au)