BookmarkSubscribeRSS Feed
KachiM
Rhodochrosite | Level 12

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;

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

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 ?

 

ChrisHemedinger
Community Manager

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.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
KachiM
Rhodochrosite | Level 12

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         
KachiM
Rhodochrosite | Level 12

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1178 views
  • 2 likes
  • 3 in conversation