Hello All, I need find out which CUSTOMER has given a "5" score immediately followed by a missing score (among the data shown above, it is C). *Q10;
data feedback;
infile datalines missover;
input Customer $
Score
Comment $30. ;
datalines;
A 3 The is no parking
A 5 The food is expensive
B . I like the food
C 5 It tastes good
C .
C 3 I like the drink
D 4 The dessert is tasty
D 2 I don't like the services
;
run;
proc print data = feedback;
run;
proc sql;
select count(distinct Customer) into :n from feedback;
select distinct Customer into :cust1 - from feedback;
run;
%macro main();
%do i=1 %to &n.;
data feedback_&&cust&i; set feedback;
where Customer = "&&cust&i";
run;
%feedback_mn(cust=&&cust&i);
%end;
%mend;
%macro feedback_mn(cust=);
data have;
set feedback;
where Customer = "&&cust&i";
%if %length(Score)= 0 and lag1(Score) = 5 %then output;
run;
proc print data = have;
run;
%mend;
%main(); Any help is highly appreciated. please check the code, I am getting this error, A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: %length(Score)= 0 and lag1(Score) = 5 ERROR: The macro FEEDBACK_MN will stop executing.
... View more