Date: Tue, 9 Nov 2010 18:51:08 -0500
Reply-To: Arthur Tabachneck <art297@ROGERS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@ROGERS.COM>
Subject: Why doesn't the format hold?
It's probably just been too long of a day but, in running some code to
test a possible response to another thread, I came across the following
discrepancy that I don't understand.
Given this set of code:
data have ;
input @1 var1 $1.
@3 var2 $1.
@5 var3 $1.
@7 var4 $1.
@9 var5 $1.;
datalines;
1 2 3 Y 5
2 3 A N 6
3 4 5 7
8 9 0 1
;
proc format;
value $testnum
' ','0','1','2','3','4','5','6','7','8','9'='9'
other='x';
run;
proc freq data=have;
format var2 $testnum.;
tables var2;
run;
.. I end up with all missing values, which was definitely not what I
expected. But, changing the 4th dataline to a non-missing value:
data have ;
input @1 var1 $1.
@3 var2 $1.
@5 var3 $1.
@7 var4 $1.
@9 var5 $1.;
datalines;
1 2 3 Y 5
2 3 A N 6
3 4 5 7
8 X 9 0 1
;
proc freq data=have;
format var2 $testnum.;
tables var2;
run;
.. I get the expected result. Have I simply been working too hard today,
or is there something obvious that I've overlooked?
Art
|