ฉันต้องการจัดทำรายงานรายวันสำหรับบริษัทของฉันโดยอัตโนมัติ แต่ฉันประสบปัญหาเล็กน้อย รายงานจะได้รับการอัปเดตเฉพาะวันทำการที่ 2 ของแต่ละเดือนเท่านั้น ฉันพบโค้ดบางส่วนบนเว็บไซต์ SAS ซึ่งระบุว่าวันทำการที่ 2 ของเดือนคือวันใด
data scdwrk;
/* advance date to the first day of the month using the INTNX function */
second=intnx('month',today(),0);
/* determine the day of the week using the WEEKDAY function */
day=weekday(second);
/* if day=Monday then advance by 1 */
if day=2 then second+1;
/* if day=Sunday then advance by 2 */
else if day=1 then second+2;
format second date9.;
run ;
ฉันได้ตั้งค่าสถานะที่เปรียบเทียบวันที่ปัจจุบันกับวันที่จากวันที่สร้างโดยโค้ดชิ้นนี้ ตอนนี้ฉันต้องหาวิธีที่หากโค้ดถูกรันในวันทำการแรกของเดือน มันจะรันชุดตัวแปรวันที่ของแมโครเฉพาะ
%let start_date="&prevmnth;
%let end_date= &endprevmnth;
%let month= &prevyearmnth;
และเมื่อรันในวันทำการที่ 2 ของเดือน มันจะใช้ชุดตัวแปรวันที่มาโครอีกชุดหนึ่ง (เดือนปฏิทิน)
%let start_date="&currmnth;
%let end_date= &endcurrmnth;
%let month= &curryearmnth;
ความช่วยเหลือใด ๆ เกี่ยวกับเรื่องนี้จะได้รับการชื่นชมอย่างมาก