Date: Tue, 29 Jan 2002 14:44:52 +0100
Reply-To: Andre Wielki <wielki@INED.FR>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Andre Wielki <wielki@INED.FR>
Subject: combination of numeric and character recoding in format
Content-Type: text/plain; charset="us-ascii"; format=flowed
Hello,
i have a solution for the following (simplified ) problem using two
separated formats with a test
if pays<99 then np=put(pays,z2.);else np=put(pays,pp.);
but i was wondering if another solution does exist mixing picture and value
to apply
only one format treating both cases (num and char)
proc format;
picture dp 01-98='99';
value pp 01-98=[dp.] 145='DK' 666='IT' 236='YU'
;
run;
data a;
input pays @@;length np $ 2;
format pays pp.; np=put(pays,pp.);
cards;
11 01 75 98 145 666 236
;
run;;
but the results present a problem even if i use default=2
429 proc format;
430 picture dp 01-98='99';
NOTE: Format DP is already on the library.
NOTE: Format DP has been output.
431 value pp 01-98=[dp.] 145='DK' 666='IT' 236='YU'
NOTE: The DP (in)format was specified on the right-hand side of an equals
sign, but without a
length specification. PROC FORMAT will assume a default length of at
least 40 for the
format being generated. If this is an insufficient width, you can
rerun PROC FORMAT with
an explicit width for the DP (in)format, or provide a sufficient
DEFAULT= option.
432 ;
NOTE: Format PP is already on the library.
NOTE: Format PP has been output.
433 run;
NOTE: PROCEDURE FORMAT used:
real time 0.02 seconds
cpu time 0.02 seconds
Applying format pays pp.; give this following result but could not
be used in a put(pays,pp.) function!
I miss something in understanding this way of doing or is it an impossible way?
Obs pays np
1 11
2 01
3 75
4 98
5 DK DK
6 IT IT
7 YU YU
Thanks in advance
Andre
___________
WIELKI Andre
INED - Service Informatique
133 Bd Davout,
75 980 Paris Cedex 20
FRANCE
Tel: 01 56 06 21 54