can't seem to figure out why my macro will not run more than once. The error i am getting is something like: "The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended". I get it... i have a messed up quote somewhere.. but i cannot find it anywhere.. please help. Here is code
proc datasets lib=work nolist kill; run; quit;
libname tw '';
libname jrd '';
ods results = off;
options varinitchk=error;
proc sort data=tw.datset_name out=x0; by inquiry_id quote_time_dt quote_time;
data quotes; set x0; by inquiry_id quote_time_dt quote_time;
if first.inquiry_id;
year =year(quote_time_dt);
count =1;
run;
data transactions; set dataset_name;
year = year(execution_time_dt);
count = 1;run;
%let q1 = swap_product instr_desc;
%let q2 = package_type;
%let q3 = dealer;
%let q4 = recipient_company;
%let t1 = swap_product instr_desc;
%let t2 = on_sef;
%let t3 = package_ind package_type;
%let t4 = alloc_ind;
%let t5 = block_ind;
%let t6 = initiating_company;
%let t7 = dealer;
%let t8 = exec_platform;
%macro create(input, vars, output);
proc summary data=&input. nway; class &vars. year; var count;
output out=t1(drop=_:) sum()=;
proc sort data=t1; by &vars.;
proc transpose data=t1 out=t2(drop=_name_); by &vars.; var count; id year;
proc summary data=t2 nway; var _numeric_;
output out=t2sums(drop=_:) sum()=;
data &output.; format &vars.; set t2 t2sums;
total = sum(of _numeric_);
array p _character_;
do over p;
if p = '' then p = 'Total';
end;
run;
%mend; quit;
%create(quotes,&q1.,table1);
%create(quotes,&q2.,table2);
%create(quotes,&q3.,table3);
%create(quotes,&q4.,table4);
%create(trans,&t1.,table5);
%create(trans,&t2.,table6);
%create(trans,&t3.,table7);
%create(trans,&t4.,table8);
%create(trans,&t5.,table9);
%create(trans,&t6.,table10);
%create(trans,&t7.,table11;
%create(trans,&t8.,table12);
@jdykstra wrote:
can't seem to figure out why my macro will not run more than once. (...)
%create(trans,&t7.,table11);
(Closing parenthesis inserted.)
Unbalanced parentheses can also cause programs to "not run more than once." However, this doesn't explain the log message about "an identifier after a quoted string."
Run it in BATCH or start a new SAS session and run it. Also use MPRINT option so you can see then code where any errors, warning or notes are referring to.
So i place "options symbolgen;" below the "options varinitchk=error" and i put "options mprint" after "%mend;"???
options varinitchk=error mprint=1 symbolgen=1;
Make it easy put them all at the top. You don't really need symbolgen.
@jdykstra wrote:
can't seem to figure out why my macro will not run more than once. (...)
%create(trans,&t7.,table11);
(Closing parenthesis inserted.)
Unbalanced parentheses can also cause programs to "not run more than once." However, this doesn't explain the log message about "an identifier after a quoted string."
Nice!! Hawk eye:)
Actually, this completely solved my issue. I can't believe i didn't see that, tbh. I'm blind.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.