@mfab - Thanks for the response. I ran your code and, sure enough, it worked, so I just assumed I had done something idiotic. I went back and checked my code and I still saw the same results, so I went back and set up a number of test cases to see if I could isolate what was causing the issue. The fundamental difference is that my example is using a character variable for the "start" values in the cntlin data set. Rather than bombard you with all the details, I think the best way to demonstrate the issue is to replicate it using your example. When I run the code below, the informat does not work as it should (though you should confirm): data a;
retain fmtname 'test_fm'
type 'I';
start = '1'; label = 10; output;
start = '2'; label = 20; output;
start = '3'; label = 30; output;
start = '4'; label = 40; output;
start = '5'; label = 50; output;
start = '6'; label = 60; output;
start = ' '; label = 99; hlo = 'O'; output;
run;
proc format cntlin=work.a library=work;
run;
data b;
b = input(3, test_fm.); output;
b = input(5, test_fm.); output;
b = input(7, test_fm.); output;
run; If I add the "I" to the hlo column, as per my original post, it does work, as in the code below.
data a;
retain fmtname 'test_fm'
type 'I';
start = '1'; label = 10; hlo = 'I';output;
start = '2'; label = 20; hlo = 'I';output;
start = '3'; label = 30; hlo = 'I';output;
start = '4'; label = 40; hlo = 'I';output;
start = '5'; label = 50; hlo = 'I';output;
start = '6'; label = 60; hlo = 'I';output;
start = ' '; label = 99; hlo = 'O'; output;
run;
proc format cntlin=work.a library=work;
run;
data b;
b = input(3, test_fm.); output;
b = input(5, test_fm.); output;
b = input(7, test_fm.); output;
run;
I suppose one response is that one create these informats based on a numeric start column. The reason that I usually use text is that I'm often feeding many informats and formats in the same cntlin data set and the start values often contain text strings. Anyway, I don't know if this fully explains why our results differed, but I figured I'd throw it out there. Thanks again, Collin
... View more