Help using Base SAS procedures

PROC Tabulate: preloadfmt

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

PROC Tabulate: preloadfmt

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;


Accepted Solutions
Solution
‎08-03-2011 04:16 PM
Respected Advisor
Posts: 3,777

Re: PROC Tabulate: preloadfmt

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.

View solution in original post


All Replies
Solution
‎08-03-2011 04:16 PM
Respected Advisor
Posts: 3,777

Re: PROC Tabulate: preloadfmt

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.

Occasional Contributor
Posts: 17

Re: PROC Tabulate: preloadfmt

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.

Occasional Contributor
Posts: 14

Re: PROC Tabulate: preloadfmt

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;

Respected Advisor
Posts: 3,777

Re: PROC Tabulate: preloadfmt

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.

Occasional Contributor
Posts: 14

Re: PROC Tabulate: 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 Smiley Sad

Respected Advisor
Posts: 3,777

Re: PROC Tabulate: preloadfmt

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 798 views
  • 0 likes
  • 3 in conversation