BookmarkSubscribeRSS Feed
rjassem1
Obsidian | Level 7

 I'm adding user defined formats to a table in SAS Studio. The script runs with no errors and a simple.freq command shows me that the formats have been applied. However, when I load the table in SAS VA (Viya), I get an error 

 

"com.sas.cas.CASException: The user-defined programming statements could not be parsed. (severity=2 reason=6 statusCode=2710055) 5 ERROR: The user-defined programming statements could not be parsed. 5 ERROR: Invalid FORMAT 'CONTINUE_EDUC_FILTER.' found. 5 ERROR: Failure opening table 'CPS20082017_FORMATTED' 5 ERROR: The action stopped due to errors. debug=0x887ff837:TKCASTAB_PARSE_ERROR"

 

 

 

-------

There is nothing wrong with the variable or the format and I can run a frequency in SAS Studio. I've used single quotes and double quotes.

 

value CONTINUE_EDUC_FILTER

0 = 'Total grad school - none' 1 = 'Total grad school (enrolled, planning, or pursuing)' ;

----------

format continue_educ_filter CONTINUE_EDUC_FILTER.;

 

Any advice would be helpful!

 

11 REPLIES 11
alexal
SAS Employee

@rjassem1,

 

Do you have an access to the CAS server logs?

alexal
SAS Employee

@rjassem1,

 

Ok, questions for you. After you created your custom format in SAS Studio, have you loaded it to the CAS server? 

rjassem1
Obsidian | Level 7

cas casauto promotefmtlib fmtlibname=myCPSformats replace;

 

.

.

.

  format  wrk_auth WRK_AUTH.;

 

 

load data=work.CPS_2008_2017 casout="CPS20082017_formatted" replace;

contents casdata="CPS20082017_formatted";

run;

quit;

 

....

 

proc casutil outcaslib="CASDATA";

 

   promote casdata="CPS20082017_formatted" incaslib="CASDATA";

 

quit;

rjassem1
Obsidian | Level 7
Does it have anything to do with me adding the formats to the WORK library to a table in the WORK library then promoting the formatted table to the cas library? I can't add the formats directly to a table in the cas library.
rjassem1
Obsidian | Level 7

Here is the actual code. I've cut back on the number of variables.

 

cas casauto sessopts=(caslib="casdata");

 

proc format library=work.formats casfmtlib="myCPSformats";    

   value AGE_C

      1 = '22 or younger' 

      2 = '23-24' 

      3 = '25-27' 

      4 = '28-30' 

      5 = '31-34' 

      6 = '35 or older' ;

   value COLLFILTER

      0 = 'Duplicate Case' 

      1 = 'Primary Case' ;

   value $COMMENTS

     '1' = ' ' ;

   value CONTINUE_EDUC_FILTER

      0 = 'Total grad school - none' 

      1 = 'Total grad school (enrolled, planning, or pursuing)' ;

   value WRK_AUTH

      1 = 'Yes' 

      2 = 'No' 

      3 = 'Unsure' ;

run;

 

 

proc cas;

   session casauto;

   sessionProp.promoteFmtLib /

      fmtLibName="myCPSformats"

      replace=true;

run;

quit;

 

cas casauto promotefmtlib fmtlibname=myCPSformats replace;   

 

cas casauto savefmtlib

   fmtlibname=myCPSformats

   caslib=casdata

   table=myCPSformats replace;

   

   

proc casutil

 

   format     AGE_C AGE_C.;

   format COLLFILTER COLLFILTER.;

   format COMMENTS $COMMENTS.;

   format continue_educ_filter CONTINUE_EDUC_FILTER.;

   format  wrk_auth WRK_AUTH.;

   

 

load data=work.CPS_2008_2017 casout="CPS20082017_formatted" replace;

 

contents casdata="CPS20082017_formatted";

run;

quit;

 

 

proc cas ;

   columninfo / table={name="CPS20082017_formatted"}; run;

 

 

proc casutil outcaslib="CASDATA";

 

   promote casdata="CPS20082017_formatted" incaslib="CASDATA";

 

quit;

 

Proc cas;

 

   session casauto;

   simple.freq / 

      inputs={"profempl2013" "yearcode" "continue_educ_filter"}

      table={name="CPS20082017_formatted"}

      ;

run;

quit;

 

alexal
SAS Employee

@rjassem1,

 

promotefmtlib is good, but you have to run "proc format" before that to generate the SAS format table from your custom format catalog and generate the CAS format library from the SAS format table.

 

Here is an example:

 

proc format library=<YOUR_LIBRARY>.formats cntlout=formats_tab;
run;
proc format cntlin=formats_tab casfmtlib="USERFORMATS1";
run;
cas mysession promotefmtlib fmtlibname=USERFORMATS1 replace;
rjassem1
Obsidian | Level 7

I may be doing something wrong. I tried adding the other proc format statements and I see formats_tab but it's still the same error. 

alexal
SAS Employee

@rjassem1,

 

That should work. Try to reach your SAS administrator and get the most recent CAS server log.

rjassem1
Obsidian | Level 7

I still get the same error and it continues even if I remove the formatted variables causing a problem.

 

com.sas.cas.CASException: The user-defined programming statements could not be parsed. (severity=2 reason=6 statusCode=2710055) 5 ERROR: The user-defined programming statements could not be parsed. 5 ERROR: Invalid FORMAT 'CONTINUE_EDUC_FILTER.' found. 5 ERROR: Failure opening table 'CPS20082017_FORMATTED'

 

Does it have something to do with where the formats are?  I'm running the results from the cas library not the WORK library and I'm promoting the library but I don't see it in a cas library. I don't get an error either.

rjassem1
Obsidian | Level 7

It turned out that I was saving the format file as MyCPSFormats and the SAS VA was looking for userformat1. I thought userformat1, userformat2 were examples not the default names.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 11 replies
  • 2857 views
  • 0 likes
  • 2 in conversation