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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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