BookmarkSubscribeRSS Feed
ohsco2007
Calcite | Level 5

Can someone assist in this error in the following code?

 

Code: 

/*BREAK APART*/
%let indata=LIC_COMPLETE;
%let outlib=WORK;
%let param=RECORD_ID2;

proc sort
data=&indata (keep=&param)
out= lookup
nodupkey;
by &param;
run;

data _null_;
call execute ('data ');
do until (eof1);
set lookup end=eof1;
call execute("&outlib.." !! trim(&param) !! ' ');
end;
call execute ("; set &indata.;");
do until(eof2);
set lookup end=eof2;
call execute("if &param = '" !! trim(&param) !! "' then output &outlib.." !! trim(&param) !! ';');
end;
call execute('run;');
stop;
run;

%let indata=LIC_INCOMPLETE1;
%let outlib=WORK;
%let param=RECORD_ID2;

proc sort
data= &indata (keep=&param)
out= lookup
nodupkey;
by &param;
run;

data _null_;
call execute ('data ');
do until (eof1);
set lookup end=eof1;
call execute("&outlib.." !! trim(&param) !! ' ');
end;
call execute ("; set &indata.;");
do until(eof2);
set lookup end=eof2;
call execute("if &param = '" !! trim(&param) !! "' then output &outlib.." !! trim(&param) !! ';');
end;
call execute('run;');
stop;
run;

%let indata=LIC_INCOMPLETE2;
%let outlib=WORK;
%let param=RECORD_ID2;

proc sort
data=&indata (keep=&param)
out= lookup
nodupkey;
by &param;
run;

data _null_;
call execute ('data ');
do until (eof1);
set lookup end=eof1;
call execute("&outlib.." !! trim(&param) !! ' ');
end;
call execute ("; set &indata.;");
do until(eof2);
set lookup end=eof2;
call execute("if &param = '" !! trim(&param) !! "' then output &outlib.." !! trim(&param) !! ';');
end;
call execute('run;');
stop;
run;

%let indata=LIC_CHECK;
%let outlib=WORK;
%let param=RECORD_ID2;

proc sort
data=&indata (keep=&param)
out= lookup
nodupkey;
by &param;
run;

data _null_;
call execute ('data ');
do until (eof1);
set lookup end=eof1;
call execute("&outlib.." !! trim(&param) !! ' ');
end;
call execute ("; set &indata.;");
do until(eof2);
set lookup end=eof2;
call execute("if &param = '" !! trim(&param) !! "' then output &outlib.." !! trim(&param) !! ';');
end;
call execute('run;');
stop;
run;

%let indata=COVERPAGE2;
%let outlib=WORK;
%let param=RECORD_ID2;

proc sort
data=&indata (keep=&param)
out= lookup
nodupkey;
by &param;
run;

data _null_;
call execute ('data ');
do until (eof1);
set lookup end=eof1;
call execute("&outlib.." !! trim(&param) !! ' ');
end;
call execute ("; set &indata.;");
do until(eof2);
set lookup end=eof2;
call execute("if &param = '" !! trim(&param) !! "' then output &outlib.." !! trim(&param) !! ';');
end;
call execute('run;');
stop;
run;

PROC SORT DATA=LIC_CHECK; BY RECORD_ID; RUN;
DATA RECORD_ID;
SET LIC_CHECK (KEEP = RECORD_ID);
BY RECORD_ID;
IF FIRST.RECORD_ID;
COUNT + 1;
RUN;

 

Errors: 

NOTE: CALL EXECUTE generated line.
1 + data
1714
1715 PROC SORT DATA=LIC_CHECK; BY RECORD_ID; RUN;
-
22
200
ERROR: No SET, MERGE, UPDATE, or MODIFY statement is present.

ERROR 22-322: Syntax error, expecting one of the following: a name,
a quoted string, (, /, ;, _DATA_, _LAST_, _NULL_.

ERROR 200-322: The symbol is not recognized and will be ignored.

1 REPLY 1
SASKiwi
PROC Star

Here is your problem statement:

call execute ('data ');

You are submitting the word DATA without a following dataset name and semicolon.

 

Remember you need to put syntactically-correct SAS code within CALL EXECUTE. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1045 views
  • 2 likes
  • 2 in conversation