- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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