Strings: From SAS code to SAS Stored process

  • Follow


Hello,
Your help is much appreciated. I am trying to convert my code to a
stored process but it does not work smoothly. I am missing something.


The line of code that starts with /*for code*/ is commented now, but
if I uncomment it and erase the one below it, I can run the code from
Enterprise Guide with no problem.

Once I try to convert the thing to a stored process, things don't
work. I use the code below as is, and I get a message saying that
there is an unclosed %do statement.
What is wrong???   I added the semicolon, and nothing else...

Your help is much appreciated.




Summary:
Code for the macro. The line version that runs from EG is commented
and marked as "for code". The alternative line is for the stored
process but it is not working:

%macro reportingfor;

%if &courseval=101 or &courseval=102 /*or &courseval=103*/ or
&courseval=105 or &courseval=106 %then
%do;


 	data forecdat2;
	set forecdat1;
	if coursecode=&courseval;
	run;
%end;
%else %do;

	%if &courseval ne . /*'ALL'*/ %then
	%do;
		data exercise;
		infoCode='Incorrect course code. All courses included in report';

		proc print data=exercise ;
		run;

	%end;

	data forecdat2;
	set forecdat1;
	run;
%end;


%if &bookclval=0 or &bookclval=1 or &bookclval=2 or &bookclval=3 or
&bookclval=4 or &bookclval=5 %then
%do;

	data forecdat3;
	set forecdat2;
	if bookingclass=&bookclval;
	run;
%end;
%else %do;
	data forecdat3;
	set forecdat2;
	run;

%end;





	/*for code*/ *%if &teeval='B01' or &teeval='B02' or &teeval='B03' or
&teeval='B04' or &teeval='B05' or &teeval='B06' or &teeval='B07' or
&teeval='B08' %then %do;
	/*for stored process*/ %if "&teeval"='B01' or "&teeval"='B02' or
"&teeval"='B03' or "&teeval"='B04' or "&teeval"='B05' or
"&teeval"='B06' or "&teeval"='B07' or "&teeval"='B08' %then %do;

	data forecdat4;
	set forecdat3;
	*if tee_time_block="&teeval";
	run;
%end;
%else %do;

		/* for code*/ /* %if &teeval ne . %then  */
		%if "&teeval" ne . %then
	%do;
		data exercise2;
		infoCode='Incorrect time block. All time blocks included in report';
		proc print data=exercise2 ;
		run;

	%end;

	data forecdat4;
	set forecdat3;
	run;

%end;


%if &partyval=1 or &partyval=2 or &partyval=3 or &partyval=4 %then
%do;
	data forecdat5;
	set forecdat4;
	if party_size=&partyval;
	run;
%end;
%else %do;
		data forecdat5;
	set forecdat4;
	run;


%end;

data forecdat6;
set forecdat5;
if play_date>="&begind"d and play_date<="&enddate"d;

data forecdat;
set forecdat6;
run;

%mend reportingfor ;

%reportingfor;
0
Reply luzsonriente (7) 3/18/2011 9:12:29 PM

only suspicious place is

*%if &teeval='B01' or &teeval='B02' or &teeval='B03' or
&teeval='B04' or &teeval='B05' or &teeval='B06' or &teeval='B07' or
&teeval='B08' %then %do;

if you change it to
/*
%if &teeval='B01' or &teeval='B02' or &teeval='B03' or
&teeval='B04' or &teeval='B05' or &teeval='B06' or &teeval='B07' or
&teeval='B08' %then %do;
*/

does it work?


regards
tomek
0
Reply tomasz 3/18/2011 9:41:49 PM


Thank you for replying.
For some reason it did not work yet. If you have any other idea it
would be greatly appreciated.


On Mar 18, 5:41=A0pm, tomasz karp <karp.tom...@gmail.com> wrote:
> only suspicious place is
>
> *%if &teeval=3D'B01' or &teeval=3D'B02' or &teeval=3D'B03' or
> &teeval=3D'B04' or &teeval=3D'B05' or &teeval=3D'B06' or &teeval=3D'B07' =
or
> &teeval=3D'B08' %then %do;
>
> if you change it to
> /*
> %if &teeval=3D'B01' or &teeval=3D'B02' or &teeval=3D'B03' or
> &teeval=3D'B04' or &teeval=3D'B05' or &teeval=3D'B06' or &teeval=3D'B07' =
or
> &teeval=3D'B08' %then %do;
> */
>
> does it work?
>
> regards
> tomek

0
Reply LAC 3/21/2011 2:38:36 PM

2 Replies
452 Views

(page loaded in 0.561 seconds)

Similiar Articles:













7/23/2012 8:29:51 AM


Reply: