Hi,
I am trying to use preloadfmt with proc tabulate but I am receiving the following error:
The format for variable SAMPLE_MONTH cannot be preloaded. Preload will have no effect.
Any suggestions?
Thanks
Code example:
proc format;
value time_frame_format (notsorted)
low-<'01JAN2008'd = 'Before 2008'
'01JAN2008'd-<'01JAN2009'd = [worddate20.]
'01JAN2009'd-<'01JAN2010'd = 'Timeframe1'
'01JAN2010'd-high = 'After timeframe1'
;
run;
proc tabulate data=work.data MISSING order=data;
class c_type;
class sample_month / preloadfmt;
var amount;
format sample_month time_frame_format.;
table = c_type, amount * SUM, c_type all='TOTAL';
run;
The problem is
'01JAN2008'd-<'01JAN2009'd = [worddate20.]
You will need to expand this, but do you really want all 366 days represented in your summary.
The problem is
'01JAN2008'd-<'01JAN2009'd = [worddate20.]
You will need to expand this, but do you really want all 366 days represented in your summary.
Thanks greatly appreciated! The sample_month field only contains the first of each month so the summary would be limited to 12 values for that specified range. I now understand that I must expand all the format ranges for preloadfmt to work.
Hi, I am having a similar problem. Can you elaborate on what you mean here? The way I'm understanding it, data _null_ is suggesting that the preloadfmt error that brian is receiving is due to the fact that he is using ranges to define his multi-label format. I too am trying to define a multi-label format to use in a proc tabulate and am receiving the error that brian noted. In my situation, it would be nearly impossible for my to individually define each of my numeric values. However, I see plenty of documented examples (incl on the SAS website) where people are successfully using ranges in their user-defined multilabel format definitions without having to expand out and define each value separately. I think I must be misunderstanding the solution here? Any help would be greatly appreciated! My situation looks something like this (hopefully no typos--i didnt copy/paste here):
proc format; picture testf (multilabel notsorted)
0-9996="0000" (prefix="2/")
9997-9999="Worst"
9997="Worse 1"
9998="Worse 2"; run;
proc tabulate data=dat1;
class vision /mlf preloadfmt order=data;
class group;
table vision,(group all)*(n colpctn);
format vision testf.; run;
Ranges are fine but not they must map to a single value.
0-9996="0000"
Doesn't say make the range 0-9996 a single value.
I've been experimenting with your program in the other thread and it "works" mostly for everything but PRELOADFMT.
AHA! This was the jist of my eventual conclusion as well. It seems that this means a picture format will never be able to be preloaded. It makes sense to me that a format could not be preloaded if it is dependent on the data itself (like a picture format is). Unfortunately, the format is useless to me if I can't apply it to this proc tabulate
You may still be able to have your cake and eat it too. Start a new thread where you explain what you want include sample data and the rest. Give exact details.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.