DATA Step, Macro, Functions and more

DOSUBL and ERROR: 180-322

Reply
Super Contributor
Posts: 298

DOSUBL and ERROR: 180-322

I am reading on DOSUBL using Rick Langston's paper on it. I wanted to get rid of Proc FCMP layer in calling a Function from Proc PROTO. I am getting the ERROR: 180-322. This means "Missing Semicolon". I have inserted semicolon in places I thought is relevant. But I don't get the results.

I give below the usual Proc FCMP layer first. It works. When I use DOSUB part given at the bottom of the listing, the said error comes.

 

Can anyone tell me my mistake?

proc proto packet = work.proto.fill;
   void c_Fillmem(double *v);
   externc c_Fillmem;
   
   void c_Fillmem(double *v)
   {
      int i;
      for ( i = 0; i < 5; i++)
         v[i] = (double) i * 10 + 100;
   }
   externcend;
quit;

proc fcmp inlib = work.proto outlib = work.fcmp.fill;
   subroutine Fillmem(v[*]);
      outargs v;
      call c_Fillmem(v);
   endsub;
quit;

options cmplib = (work.proto work.fcmp);

data _null_;
   array k[5] _temporary_;
   call Fillmem(k);
   do i = 1 to 5;
      put k[i] = ;
   end;
run;

/** Using DOSUBL() for the above **/
options cmplib = (work.proto );

data _null_;
   array k[5] _temporary_;
   rc = dosubl("call c_FillMem(k)");
   do i = 1 to 5;
      put k[i] = ;
   end;
run;

PROC Star
Posts: 1,759

Re: DOSUBL and ERROR: 180-322

[ Edited ]

This error is generic to SAS not recognizing what is submitted. You also get it if you submit

data _null_;
  abcde;
run;

Sorry I can't help further as I have no idea why your code is failing, but I await an informed reply with interest. @Rick_SAS or @ChrisHemedinger may be able to help ?

 

Community Manager
Posts: 2,952

Re: DOSUBL and ERROR: 180-322

When you use DOSUB or DOSUBL, you need to have a complete standalone "step" within the code you are passing.  So you need to have a complete DATA step, PROC step, or macro statement or global statement (like OPTIONS or SYSECHO).  The "call c_Fillmem" code is a fragment that cannot be processed as its own step.  

 

I'm not sure what your goal is here as you have a step that's working when you call the function directly.  If you're trying to run this code in parallel across a bunch of data, you might look at PROC DS2 and its ability for multithreading.

Super Contributor
Posts: 298

Re: DOSUBL and ERROR: 180-322

Posted in reply to ChrisHemedinger

Chris:

 

I am trying to get the array cells filled while I am waiting inside the data step.

PROC FCMP bridged the call happily. So I tried DOSUBL to bypass the FCMP bridge,

 

Now I placed the entire PROC within DOSUBL(). It does not work as it worked with FCMP bridge. Here is my Log. I am using SASUE(using the latest version).

 



 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 55         
 56         options cmplib = (work.proto);
 57         
 58         data _null_;
 59            array k[5] _temporary_;
 60            rc = dosubl('
 61         proc proto packet = work.proto.fill;
 62             void c_Fillmem(double *v);
 63             externc c_Fillmem;
 64         
 65             void c_Fillmem(double *v)
 66             {
 67               int i;
 68               for ( i = 0; i < 5; i++)
 69                  v[i] = (double) i * 10 + 100;
 70             }
 71             externcend;
 72          ');
 73         
 74            do i = 1 to 5;
 75               put k[i] = ;
 76            end;
 77         run;
 
 NOTE: Prototypes saved to WORK.PROTO.FILL.
 NOTE: PROCEDURE PROTO used (Total process time):
       real time           0.08 seconds
       cpu time            0.08 seconds
       
 
 k[1]=.
 k[2]=.
 k[3]=.
 k[4]=.
 k[5]=.
 NOTE: DATA statement used (Total process time):
       real time           0.25 seconds
       cpu time            0.24 seconds
       
 
 78         
 79         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 91         
Super Contributor
Posts: 298

Re: DOSUBL and ERROR: 180-322

Just now I heard from Rick Langston that DOSUBL does not address my circumstance but PROC FCMP does. I will use Proc FCMP for my purpose.

Ask a Question
Discussion stats
  • 4 replies
  • 383 views
  • 2 likes
  • 3 in conversation