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

Why does it behave like this?

It gives an error "format not found and could not be loaded" BUT it resolves correctly to the format when I open the promoted table in Visual Analytics.

 

I want both libraries BUSINESS_MAPPER and myfmtlib to be available at SAS Studio.

@Ksharp @BrunoMueller get credits that I've come so far, because my primary goal was to use UDF in Visual Analytics and that is achieved.

But it's unclear to me why it shows up in global and session scope but cannot be used with a format statement.

 

options nofmterr;

proc delete data=public.test_udf;
run;

data public.test_udf(promote=yes);
set RISKNOBA.TMAIMG_GRVR_MATCH;
literal1=gr_vr;
literal=gr_vr;
FORMAT LITERAL $grvr_lit. literal1 $brand.;
RUN;

envir3.pngenvir2.png

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

It seems that currently there is not a simple way to have CAS Formats available as SAS Formats.

 

The is the sessionProp.listFmtRanges action that will list the range definitions, this can be saved to a SAS data set. You still need some logic to make a SAS format out of it.

 

Here is a sample to write the result of sessionProp.listFmtRanges to a SAS data set:

cas sugus sessopts=(caslib="casuser");

proc cas;
  action sessionProp.listFmtRanges result=results / fmtlibname="userfmtlib";
  saveresult results dataout=work.fmt;
  run;
quit;

View solution in original post

3 REPLIES 3
BrunoMueller
SAS Super FREQ

If you DATA Step runs on the SAS Compute Server, then the formats used, must be available as a SAS Catalog entry.

 

Proc FORMAT will be default always create a format as a SAS catalog entry, default catalog is WORK.FORMATS.

 

Formats that are available as a CAS format library are not available to the SAS Compute Server.

 

In short: formats can/must exist in two locations, depending on how they are used:

  • on the SAS side in a SAS Catalog
  • on the CAS Server side as CAS Format Library

 

Hope this information helps

acordes
Rhodochrosite | Level 12

OK, understood.

Is there an easy way to populate the work.format catalogue again with a format

fmt.png from the caslib catalogue?

 

With this code I write to the log the format values.

I could copy paste them into a data step and re-create the format in work.formats.

But that's too complicated, isn't it?

 

cas mysession listformats fmtlibname=business_mapper members ;

cas mysession listfmtranges fmtname=$grvr_lit;
BrunoMueller
SAS Super FREQ

It seems that currently there is not a simple way to have CAS Formats available as SAS Formats.

 

The is the sessionProp.listFmtRanges action that will list the range definitions, this can be saved to a SAS data set. You still need some logic to make a SAS format out of it.

 

Here is a sample to write the result of sessionProp.listFmtRanges to a SAS data set:

cas sugus sessopts=(caslib="casuser");

proc cas;
  action sessionProp.listFmtRanges result=results / fmtlibname="userfmtlib";
  saveresult results dataout=work.fmt;
  run;
quit;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 726 views
  • 2 likes
  • 2 in conversation