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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 723 views
  • 0 likes
  • 3 in conversation