BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bsas94
Obsidian | Level 7

Hey experts!

 

I would like to know if anybody has already created any format based on a proc fcmp function and used it in SAS Marketing Automation or SAS Information Maps?

 

With the help of some people here, the following code was created:

 

libname funcs '/serverpath';


/**create function**/
proc fcmp outlib = funcs.functions.myfuncs;
function addZeros(x $) $;
res = catt(repeat('0', lengthm(x)-length(x)-1),x);
return (res);
endsub;
run;


options cmplib= funcs.functions;

libname formats = '/serverpath';

options fmtsearch = (formatos.formats);

/**create new format***/ proc format library = formats; value $addFormatTest other=[addZeros()]; run;

When I try to test it in Information Map, I get the error: 

 

ERROR: The format AddFormatTest has a label that defines another format to be   loaded (named AddZeros), but this format could not be successfully   loaded (possibly for the same reason).

Even though deleting every function stored, I get the same error when I test it in Infomap. 

 

In EG it works just fine.

 

Any ideas?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Dmitry_Alergant
Pyrite | Level 9

Hi,

 

We have resorted to FCMP+Format approach on several occasions with some of our customers,  I know for certain that it works in SAS MA.

 

I'm somewhat surprised that for a very simple use case like yours (lead zero padding), isn't there a proper built-in format in SAS, did you look well? Like Zx. (Z10.)? 

 

But since as you say the this code-driven format already works for you in SAS EG but doesn't work through an Information Map, I would first check if "option cmplib" (and option fmtsearch)  is being executed within SAS Workspace Server and SAS Pooled Workspace Server context by default.

 

The proper way to make it happen would be in WorkspaceServer/autoexec_usermods.sas, PooledWorkspaceServer/autoexec_usermods.sas and StoredProcessServer/autoexec_usermods.sas.

 

Then restart an Object Spawner after the change.

 

WorkspaceServer is what is being used when you test the infomap from SAS Information Studio, and I think it is also occasionally used by SAS MA (may depend on a version). PooledWorkspaceServer is normally used by SAS MA for most sql queries.  Depending on your use case,  you may also need it in the Stored Process Server context for SAS MA.  So I suggest to put it into all 3 autoexecs.

 

If not for that, then maybe try to rename both a format and a function to shorter names, not to exceed 7-8 characters... 

 

Hope it helps!

-------
Dmitriy Alergant, Tier One Analytics

View solution in original post

1 REPLY 1
Dmitry_Alergant
Pyrite | Level 9

Hi,

 

We have resorted to FCMP+Format approach on several occasions with some of our customers,  I know for certain that it works in SAS MA.

 

I'm somewhat surprised that for a very simple use case like yours (lead zero padding), isn't there a proper built-in format in SAS, did you look well? Like Zx. (Z10.)? 

 

But since as you say the this code-driven format already works for you in SAS EG but doesn't work through an Information Map, I would first check if "option cmplib" (and option fmtsearch)  is being executed within SAS Workspace Server and SAS Pooled Workspace Server context by default.

 

The proper way to make it happen would be in WorkspaceServer/autoexec_usermods.sas, PooledWorkspaceServer/autoexec_usermods.sas and StoredProcessServer/autoexec_usermods.sas.

 

Then restart an Object Spawner after the change.

 

WorkspaceServer is what is being used when you test the infomap from SAS Information Studio, and I think it is also occasionally used by SAS MA (may depend on a version). PooledWorkspaceServer is normally used by SAS MA for most sql queries.  Depending on your use case,  you may also need it in the Stored Process Server context for SAS MA.  So I suggest to put it into all 3 autoexecs.

 

If not for that, then maybe try to rename both a format and a function to shorter names, not to exceed 7-8 characters... 

 

Hope it helps!

-------
Dmitriy Alergant, Tier One Analytics
How to improve email deliverability

SAS' Peter Ansbacher shows you how to use the dashboard in SAS Customer Intelligence 360 for better results.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 860 views
  • 0 likes
  • 2 in conversation