- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi! guys! I have a question about SAS Macro:
I've written the code below:
data Profile1;
set Profile;
Age = intck("year", Birthday, today());
run;
%macro profile1(title,state,age,year,Total_balance);
proc report data=Profile1 nowd colwidth=10 spacing=5 headline headskip;
column Acct_ID Name Age Balance Last_Tran_Date;
define Last_Tran_Date / format = ddmmyy10.;
compute before _page_ / style={just=left};
line @1 "Title: &title" @50 "Run Date: &sysdate";
line @1 "State:" &state @40 "Age: >= &age" @62 "Tran Year: &year";
line " ";
endcomp;
%if &Total_balance = on %then %do;
compute after /style={just=left} ;
line 60* " ";
line @1 "Total Balance:" @38 balance.sum dollar12.;
endcomp;
%end;
where Age >= &age and state in (&state) and year(Last_Tran_Date)= &year;
%mend;
%profile1(title= Detail Listing Of Account,state =%str("NY"),age=40,year=2016,Total_balance=on);
The question is:
If I only input single state such as "NY", I can run this program successfully, but i can't call multiple states; such as: %profile1(title= Detail Listing Of Account,state =%str("NY, CA"),age=40,year=2016,Total_balance=on);
Can you help me to fix this problem? Thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just specify the states as shown in the task description: %str("NY", "CA").