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

I would like to test if a format can be preloaded.   Is there an easy way to test: "is a SAS format, calls a function, or contains a nested format in its definition."

 

520        proc summary data=sashelp.class completetypes;
521           class sex / preloadfmt;
522           format sex $upcase.;
523           output;
524           run;

NOTE: Multiple concurrent threads will be used to summarize data.
WARNING: The format for variable Sex cannot be preloaded. 
A finite set of formatted values cannot be produced from the format.  
The format is not recognized, is a SAS format, calls a function, or contains a nested format in its definition. 
Preload will have no effect.
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.DATA1 has 3 observations and 3 variables.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Looks like perhaps having 'F' in HLO variable?

proc format cntlout=definition ;
value simple 1='One' 2='Two';
value compound 3='Three' other=[simple.] ;
value range 10-12='Pre-teen' 13-19='Teen' other='Other';
run;

proc print data=definition; 
 where fmtname in ('SIMPLE' 'COMPOUND' 'RANGE');
 var  fmtname type hlo start end label ;
run;


proc summary data=sashelp.class completetypes;
  class age / preloadfmt;
  format age simple. ;
  output;
run;

proc summary data=sashelp.class completetypes;
  class age / preloadfmt;
  format age compound. ;
  output;
run;

proc summary data=sashelp.class completetypes;
  class age / preloadfmt;
  format age range. ;
  output;
run;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

I would assume you could figure that out by looking the CNTLOUT dataset generated by PROC FORMAT for that format.

 

Did you try that?

Tom
Super User Tom
Super User

Looks like perhaps having 'F' in HLO variable?

proc format cntlout=definition ;
value simple 1='One' 2='Two';
value compound 3='Three' other=[simple.] ;
value range 10-12='Pre-teen' 13-19='Teen' other='Other';
run;

proc print data=definition; 
 where fmtname in ('SIMPLE' 'COMPOUND' 'RANGE');
 var  fmtname type hlo start end label ;
run;


proc summary data=sashelp.class completetypes;
  class age / preloadfmt;
  format age simple. ;
  output;
run;

proc summary data=sashelp.class completetypes;
  class age / preloadfmt;
  format age compound. ;
  output;
run;

proc summary data=sashelp.class completetypes;
  class age / preloadfmt;
  format age range. ;
  output;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1682 views
  • 2 likes
  • 2 in conversation