BookmarkSubscribeRSS Feed
DTFX-JJ
Fluorite | Level 6
I'm trying to do some comparisons (for personal preference) between using a data step and proc DS2 for certain tasks.

The problem is that i've hit the snag of not having compged/complev/soundex functions available from within the run method.

Is there any way to access these functions from within Proc DS2? Or alternatively from proc FCMP?

I've gone through the language guides and i can't seem to find anything relevant.

Help is much appreciated.
3 REPLIES 3
ChrisBrooks
Ammonite | Level 13

That's a very good question. I've tried to create an FCMP function and then a DS2 FCMP package using that function and while the original function works fine in Base SAS it fails when called through the DS2 FCMP function with an error :

 

ERROR: Cannot find a library containing subroutine SOUNDEX.

This leads me to believe that functions not supported in DS2 can't be called even when wrapped inside an FCMP function.

 

For the record here's my code complete with tests

 

proc fcmp outlib=work.funcs;
	function mysoundex(name $) $;
	length retval $4;
	put name=;
	retval=soundex(name);
	put retval=;
		return(retval);
	endsub;
run;

options cmplib=work.funcs;

data _null_;
	length rc $4;

	set sashelp.class;
	rc=mysoundex(name);
	put rc=;
run;

proc ds2;
	package sndx / overwrite=yes
	language='fcmp'
	table='work.funcs';
run;
quit;


data class;
	set sashelp.class;
run;

proc ds2;
	data _null_;
	dcl package sndx myval();
	dcl char(4) retval;
	method run();
		set class;
		retval=myval.mysoundex(name);
		put retval=;
	end;

run;
quit;

I would encourage you to log a support track with SAS which you can do here -> https://support.sas.com/ctx/supportform/createForm in case they have any suggestions... 

Tom
Super User Tom
Super User

I don't know about the other functions on your list but why not trying use SAS macro processor to handle your need for the SOUNDEX() function.

See if you can translate this simple datastep into PROC DS2 step.

data test ;
  set sashelp.class ;
  x1 = soundex(name);
  x2 = resolve('%sysfunc(soundex('||name||'))');
run;
DTFX-JJ
Fluorite | Level 6
Unfortunately, using the resolve function inside the run method causes a compilation failure due to unknown function 'resolve'... Can't seem to find much with this regard either. Going to look into it some more in the meantime, thanks!

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 840 views
  • 0 likes
  • 3 in conversation