[爆卦]macro語法是什麼?優點缺點精華區懶人包

為什麼這篇macro語法鄉民發文收入到精華區:因為在macro語法這個討論話題中,有許多相關的文章在討論,這篇最有參考價值!作者domoto01 (Chia)看板Statistics標題[程式] SAS macro語法的lo...



[軟體程式類別]:
SAS

[程式問題]:
SAS跑macro語法的log,出現
「NOTE: 對遺漏值執行作業,因此導致產生了遺漏值。
每個位置的指定方式: 在 (行):(欄) 的 (次數)。
89 (位於 1:234) 222 (位於 1:221) 222 (位於 2:191)
222 (位於 2:216) 219 (位於 2:222) 202 (位於 1:221)
202 (位於 2:191) 20 (位於 2:197) 202 (位於 2:216)
102 (位於 2:222)」

[軟體熟悉度]:
熟悉

[問題敘述]:
我的問題是:log說明的位置(1:234)我不知道是指語法的什麼地方。
我有找到一個英文的資料
(https://www.lexjansen.com/wuss/2006/data_presentation_and_business_
intelligence/DPR-Sherman.pdf)
但看完還是不懂(根據英文資料的範例,我不知道上面寫的line=block怎麼找),
想要試著比對我的語法也比對不太出來。
所以想問問版上的朋友是否有經驗可以分享,感謝。
以下列出我的語法

[程式範例]:
696 options nosymbolgen mprint;
697 %macro QQ(Q1,Q2);
698 data &Q1. ;
699 set &Q2. ;
700
701 %macro ch1(XX0058,XX0059,fv01,a,b,c,);
702 if &XX0058 in('N','8888','R','9999') then &fv01=.;
703 else if &XX0058='1' and &XX0059 in('N','8888','R','9999') then &fv01=.;
704 else if &XX0058='1' and &XX0059='1' then &fv01=XX0&a*7;
705 else if &XX0058='1' and &XX0059='2' then &fv01=XX0&b*1;
706 else if &XX0058='1' and &XX0059='3' then &fv01=XX0&c*(1/4);
707 else if &XX0058='2' then &fv01=0;
708
709 if XX0&a in(8888,9999) then &fv01=.;
710 if XX0&b in(8888,9999) then &fv01=.;
711 if XX0&c in(8888,9999) then &fv01=.;
712 %mend ch1; /**/
713 %ch1(XX0154,XX0155,f020,156,156,158);
714
715 %macro ch7(XX0140,fv01,a,b,c);
716 if &XX0140 in('N','8888','R','9999') then &fv01=.;
717 else if &XX0140='1' then &fv01=XX0&a*7;
718 else if &XX0140='2' then &fv01=XX0&b*1;
719 else if &XX0140='3' then &fv01=XX0&c*(1/4);
720 else &fv01=0;
721
722 if XX0&a in(8888,9999) then &fv01=.;
723 if XX0&b in(8888,9999) then &fv01=.;
724 if XX0&c in(8888,9999) then &fv01=.;
725 %mend ch7;
726 %ch7(XX0099,f009,101,102,103);
727
728 %macro x(a,b,y);
729 if &a in('N','8888','R','9999') then &y=.;
730 if &a='1' and &b in('N','8888','R','9999') then &y=.;
731 if &a='1' and &b='1' then &y=1.5;
732 if &a='1' and &b='2' then &y=1;
733 if &a='1' and &b='3' then &y=0.5;
734
735 count=sum(of count1-count2);
736
737 if XX1374 in('N','8888','R','9999') then drink=.;
738 else if XX1374='1' then drink=XX1375*7;
739 else if XX1374='2' then drink=XX1376*1;
740 else if XX1374='3' then drink=XX1377*(1/4);
741 else drink=0;
742
743 F024=drink/count*count1;
744 F025=drink/count*count2;
745
746 %mend;
747 %x(XX1351,XX1352,count1);
748 %x(XX1353,XX1354,count2);
749
750 run;
751 %MEND QQ;
752 %QQ(YY,b.YY0);
MPRINT(QQ): data YY ;
MPRINT(QQ): set b.YY0 ;
MPRINT(CH1): if XX0154 in('N','8888','R','9999') then f020=.;
MPRINT(CH1): else if XX0154='1' and XX0155 in('N','8888','R','9999') then
f020=.;
MPRINT(CH1): else if XX0154='1' and XX0155='1' then f020=XX0156*7;
MPRINT(CH1): else if XX0154='1' and XX0155='2' then f020=XX0156*1;
MPRINT(CH1): else if XX0154='1' and XX0155='3' then f020=XX0158*(1/4);
MPRINT(CH1): else if XX0154='2' then f020=0;
MPRINT(CH1): if XX0156 in(8888,9999) then f020=.;
MPRINT(CH1): if XX0156 in(8888,9999) then f020=.;
MPRINT(CH1): if XX0158 in(8888,9999) then f020=.;
MPRINT(QQ): ;
MPRINT(CH7): if XX0099 in('N','8888','R','9999') then f009=.;
MPRINT(CH7): else if XX0099='1' then f009=XX0101*7;
MPRINT(CH7): else if XX0099='2' then f009=XX0102*1;
MPRINT(CH7): else if XX0099='3' then f009=XX0103*(1/4);
MPRINT(CH7): else f009=0;
MPRINT(CH7): if XX0101 in(8888,9999) then f009=.;
MPRINT(CH7): if XX0102 in(8888,9999) then f009=.;
MPRINT(CH7): if XX0103 in(8888,9999) then f009=.;
MPRINT(QQ): ;
MPRINT(X): if XX1351 in('N','8888','R','9999') then count1=.;
MPRINT(X): if XX1351='1' and XX1352 in('N','8888','R','9999') then count1=.;
MPRINT(X): if XX1351='1' and XX1352='1' then count1=1.5;
MPRINT(X): if XX1351='1' and XX1352='2' then count1=1;
MPRINT(X): if XX1351='1' and XX1352='3' then count1=0.5;
MPRINT(X): count=sum(of count1-count2);
MPRINT(X): if XX1374 in('N','8888','R','9999') then drink=.;
MPRINT(X): else if XX1374='1' then drink=XX1375*7;
MPRINT(X): else if XX1374='2' then drink=XX1376*1;
MPRINT(X): else if XX1374='3' then drink=XX1377*(1/4);
MPRINT(X): else drink=0;
MPRINT(X): F024=drink/count*count1;
MPRINT(X): F025=drink/count*count2;
MPRINT(QQ): ;
MPRINT(X): if XX1353 in('N','8888','R','9999') then count2=.;
MPRINT(X): if XX1353='1' and XX1354 in('N','8888','R','9999') then count2=.;
MPRINT(X): if XX1353='1' and XX1354='1' then count2=1.5;
MPRINT(X): if XX1353='1' and XX1354='2' then count2=1;
MPRINT(X): if XX1353='1' and XX1354='3' then count2=0.5;
MPRINT(X): count=sum(of count1-count2);
MPRINT(X): if XX1374 in('N','8888','R','9999') then drink=.;
MPRINT(X): else if XX1374='1' then drink=XX1375*7;
MPRINT(X): else if XX1374='2' then drink=XX1376*1;
MPRINT(X): else if XX1374='3' then drink=XX1377*(1/4);
MPRINT(X): else drink=0;
MPRINT(X): F024=drink/count*count1;
MPRINT(X): F025=drink/count*count2;
MPRINT(QQ): ;
MPRINT(QQ): run;

NOTE: 對遺漏值執行作業,因此導致產生了遺漏值。
每個位置的指定方式: 在 (行):(欄) 的 (次數)。
89 (位於 1:234) 222 (位於 1:221) 222 (位於 2:191) 222 (位於
2:216) 219 (位於 2:222) 202 (位於 1:221)
202 (位於 2:191) 20 (位於 2:197) 202 (位於 2:216) 102 (位於
2:222)
NOTE: 已從資料集 B.YY0. 讀取 441 個觀測值
NOTE: 資料集 WORK.YY 有 441 個觀測值和 2021 個變數。
NOTE: 已使用 DATA 陳述式 (總處理時間):
實際時間 0.07 秒
CPU 時間 0.07 秒


--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.231.30.63 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1599582807.A.CCF.html
bugle: 234行的第1碼出現了89次的遺漏值 09/16 10:35

你可能也想看看

搜尋相關網站