[問題] SAS巨集
請教一下版上的高手 感謝
我寫了一個巨集 但是 跑出來不是我要的(我是SAS新手)>"<
不曉得是哪裡錯了=.=
% macro age(a);
% macro icd(b);
data test.rate_&a;
set test.rate_&b;
by sex year agesub;
retain count count_total;
if first.agesub then do;
count=1;
count_total=count;
end;
else do;
count=count+1;
count_total=count_total+count;
end;
if last.agesub;
% mend icd;
% icd(140);
% icd(150);
% icd(151);
% mend age;
% age(1401);
% age(1501);
% age(1511);
run;
我想要上面巨集跑出來的結果
跟下面分開寫跑出來的結果 一樣
但是 不曉得我巨集哪裡寫錯了 跑不出我要的結果
data test.rate_1401;
set test.rate_140;
by sex year agesub;
retain count count_total;
if first.agesub then do;
count=1;
count_total=count;
end;
else do;
count=count+1;
count_total=count_total+count;
end;
if last.agesub;
run;
-------------------------------------------
data test.rate_1501;
set test.rate_150;
by sex year agesub;
retain count count_total;
if first.agesub then do;
count=1;
count_total=count;
end;
else do;
count=count+1;
count_total=count_total+count;
end;
if last.agesub;
run;
--------------------------------------------
data test.rate_1511;
set test.rate_151;
by sex year agesub;
retain count count_total;
if first.agesub then do;
count=1;
count_total=count;
end;
else do;
count=count+1;
count_total=count_total+count;
end;
if last.agesub;
run;
--
◢█◢▊◢◣◢◣◢▉ ▋ ◢◣◢◣◢◣
█ ▊▊▉ ▉ ▊▉█▋▊ ▊▉▊▉
◥◣◥▉▉ ▉ █◤ ▋ ▊ ◥◣◥◣ 擁抱讓距離更接近
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.231.152.142
※ 編輯: carrotree 來自: 61.231.152.142 (07/22 23:01)
→
07/22 23:06, , 1F
07/22 23:06, 1F
→
07/22 23:07, , 2F
07/22 23:07, 2F
→
07/22 23:36, , 3F
07/22 23:36, 3F
→
07/22 23:36, , 4F
07/22 23:36, 4F
→
07/22 23:38, , 5F
07/22 23:38, 5F
→
07/22 23:39, , 6F
07/22 23:39, 6F
→
07/23 00:05, , 7F
07/23 00:05, 7F
推
07/24 00:00, , 8F
07/24 00:00, 8F
→
07/24 09:28, , 9F
07/24 09:28, 9F
→
07/24 22:53, , 10F
07/24 22:53, 10F
→
01/02 14:57,
7年前
, 11F
01/02 14:57, 11F