Hello,
I'm facing a problem while trying to create a code DS2 to create and execute a post this is my code :
proc ds2; data test / overwrite=yes; /*dcl varchar(65000) response;*/ method init(); dcl package tap_restcallout scbQuery(); dcl integer rc sc; rc=scbQuery.createPost( 'https://hooks.slack.com/services/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'); sc=scbQuery.executePost(payload={"text": "tttttt"}); put 'RC=' rc; put 'SC= ' sc; end; enddata; run; quit;
Please find in attachement the code SAS DS2 for the package tap_restcallout
Log:
Your package contains an overloaded definition for the createPost method. One of the methods requires 5 parameters, the other 7:
method createPost(nvarchar(16384) url, int timeout, nvarchar(256) userid, nvarchar(256) password, in_out int rc);
method createPost(nvarchar(16384) url, nvarchar(16384) contentType, nvarchar(16384) accept, int timeout, nvarchar(256) userid, nvarchar(256) password, in_out int rc);
When you call the method in your code, DS2 looks for a method definition that has the same number of parameters. Your method call looks like this:
scbQuery.createPost( 'https://hooks.slack.com/services/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');
Because your method call only provides one parameter value, there is no method definition in the package that matches that pattern, and DS2 throws the error:
ERROR: Line 84: No method declaration for method createpost matches the given argument list.
Your call to the executePost method has the same problem, resulting in the error:
ERROR: Line 85: No method declaration for method executepost matches the given argument list.
When you call a method in a DS2 data program, you must provide values for all parameters in order to execute the method without error.
Your package contains an overloaded definition for the createPost method. One of the methods requires 5 parameters, the other 7:
method createPost(nvarchar(16384) url, int timeout, nvarchar(256) userid, nvarchar(256) password, in_out int rc);
method createPost(nvarchar(16384) url, nvarchar(16384) contentType, nvarchar(16384) accept, int timeout, nvarchar(256) userid, nvarchar(256) password, in_out int rc);
When you call the method in your code, DS2 looks for a method definition that has the same number of parameters. Your method call looks like this:
scbQuery.createPost( 'https://hooks.slack.com/services/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');
Because your method call only provides one parameter value, there is no method definition in the package that matches that pattern, and DS2 throws the error:
ERROR: Line 84: No method declaration for method createpost matches the given argument list.
Your call to the executePost method has the same problem, resulting in the error:
ERROR: Line 85: No method declaration for method executepost matches the given argument list.
When you call a method in a DS2 data program, you must provide values for all parameters in order to execute the method without error.
Both of the CreatePost methods in the code show 4 or more arguments. Your call in the code
rc=scbQuery.createPost( 'https://hooks.slack.com/services/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');
uses only one.
I don't do DS2 but that in a generic "number of parameters should match the parameters in the method call" way looks suspicious. Maybe you want another that only uses the URL??
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.