Hi:
Speaking from the standpoint of the INPUT/INFORMAT/INVALUE, you could have done something incorrect with leading or trailing blanks that would make the INPUT not assigne the right number. So, then, when you went back to apply the format again, you wouldn't have a match. Something along the lines of:
[pre]
proc format;
invalue namef ' Alfred' = 1
'AliCE' =2
' Barbara '=3
'CaroL'=4
'Henry'=5
'James'=6
'Jane'=7
'Janet'=8
'Jeffrey'=9
'John'=10
'Joyce'=11
'Judy'=12
'Louise'=13
'Mary'=14
'Philip'=15
'Robert'=16
'Ronald'=17
'Thomas'=18
'William'=19
other = 0;
value numf 1= 'Alfred'
2='Alice'
3='Barbara'
4='Carol'
5='Henry'
6='James'
7='Jane'
8='Janet'
9='Jeffrey'
10='John'
11='Joyce'
12='Judy'
13='Louise'
14='Mary'
15='Philip'
16='Robert'
17='Ronald'
18='Thomas'
19='William';
run;
data newvar;
length name_number alt_nn 8;
set sashelp.class;
name_number = input(name, $namef.);
alt_nn = input(name,$namef2.);
run;
proc contents data=newvar;
title 'Proc Contents';
run;
ods listing;
proc freq data=newvar;
title 'Proc Freq';
tables name_number alt_nn;
run;
proc print data=newvar;
title 'Proc Print';
var name name_number alt_nn;
format name_number alt_nn numf.;
run;
[/pre]
It's possible that when you read the character string, that either some default length or some data condition was not accounted for. For example, in the above INFORMAT, the first 4 names will not match to SASHELP.CLASS because of leading/trailing blanks or badly capitalized entry.
So then, when the proc print runs, and uses the FORMAT that will, I think, display the right name for the number, I get 4 people who don't match.
I did not go into CNTLIN/CNTLOUT to build my INFORMAT and FORMAT -- but generally, it's little things like that -- default lengths, different treatment of spaces, etc that might have made your program not work.
cynthia
The output from PROC FREQ and PROC PRINT:
[pre]
Proc Freq
Cumulative Cumulative
name_number Frequency Percent Frequency Percent
----------------------------------------------------------------
0 4 21.05 4 21.05
5 1 5.26 5 26.32
6 1 5.26 6 31.58
7 1 5.26 7 36.84
8 1 5.26 8 42.11
9 1 5.26 9 47.37
10 1 5.26 10 52.63
11 1 5.26 11 57.89
12 1 5.26 12 63.16
13 1 5.26 13 68.42
14 1 5.26 14 73.68
15 1 5.26 15 78.95
16 1 5.26 16 84.21
17 1 5.26 17 89.47
18 1 5.26 18 94.74
19 1 5.26 19 100.00
Cumulative Cumulative
alt_nn Frequency Percent Frequency Percent
-----------------------------------------------------------
0 19 100.00 19 100.00
Proc Print
name_
Obs Name number alt_nn
1 Alfred 0 0
2 Alice 0 0
3 Barbara 0 0
4 Carol 0 0
5 Henry Henry 0
6 James James 0
7 Jane Jane 0
8 Janet Janet 0
9 Jeffrey Jeffrey 0
10 John John 0
11 Joyce Joyce 0
12 Judy Judy 0
13 Louise Louise 0
14 Mary Mary 0
15 Philip Philip 0
16 Robert Robert 0
17 Ronald Ronald 0
18 Thomas Thomas 0
19 William William 0
[/pre]