Date: Sat, 9 Aug 2008 00:40:54 GMT
Reply-To: Lou <lpogoda@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogoda@VERIZON.NET>
Subject: Re: put statement
The first problem is that you've posted a jumble of code and results, the
lines have been wrapped, and it's a little hard to sort out what's going on.
The second problem is that the errors concern the PUT function, not the PUT
statement. The PUT statement writes values out to a (non-SAS) file. The
PUT function takes a value, transforms it using a format, and stores the
result in a character variable.
Take a look at your ERROR messages - they say that the variable you're
trying to use in the PUT function is a numeric variable, and you're trying
to use a character format. That's a no-no. SAS searches the format
catalogs in the format search path for a numeric format of the same name,
but it doesn't find one, and so issues the error message.
The stuff you've printed out from the format catalogs are all character
formats (I can tell because the format names all begin with a dollar sign
($) and numeric formats cannot begin with a $), and as such cannot be used
with a numeric variable.
You need either numeric formats comparable to your character formats, or you
need to define your 'pp' variable as character. Which suggests another
problem - the formats you've printed out appear to deal with letter values,
not numbers, and I don't see how you'd get values like A, B, etc. into your
numeric pp variable.
"Nanita" <susana.urbano@gmail.com> wrote in message
news:d7fff89e-3059-4caa-bd51-97d60912e5f7@f36g2000hsa.googlegroups.com...
Hi all,
i'm looking at this code:
data rd_pos.payment_cycles(drop=pp reason
rename=(paymentperiod1=paymentperiod)) errors_cycles;
length reason $200;
set payment_cycles;
set rd_stage.Account_paymtypechange(rename=(paymentperiod=pp
dtbegin=dtcyclebegin dtend=dtcycleend PAYMENTAMOUNTS=PAYMENTAMOUNT)
drop=company) key=instid ;
if (_iorc_ ne 0) then do;
put 'not found';
_error_=0;
reason='Contract does not apeear on Payment Cycle table';
output errors_cycles;
end;
else do while (_iorc_ = 0);
set rd_stage.Account_paymtypechange(rename=(paymentperiod=pp
dtbegin=dtcyclebegin dtend=dtcycleend PAYMENTAMOUNTS=PAYMENTAMOUNT)
drop=company) key=instid;
paymentmaturity = put(pp, $MAP_PERIODS_MAT11.)+0;
paymentperiod1 = put(pp, $MAP_PERIODS_UNIT8.);
interestperiod = put(pp, $MAP_PERIODS_UNIT8.);
amortizationperiod = put(pp, $MAP_PERIODS_UNIT8.);
interestmaturity = put(pp, $MAP_PERIODS_MAT8.)+0;
amortizationmaturity = put(pp, $MAP_PERIODS_MAT11.)+0;
if _iorc_= 0 then
output rd_pos.payment_cycles;
end;
_error_=0;
run;
and returns the following error:
21389 paymentmaturity = put(pp, $MAP_PERIODS_MAT10.)+0;
-------------------
48
WARNING: Variable pp has already been defined as numeric.
ERROR 48-59: The format MAP_PERIODS_MAT was not found or could not be
loaded.
21390 paymentperiod1 = put(pp, $MAP_PERIODS_UNIT10.);
--------------------
48
WARNING: Variable pp has already been defined as numeric.
21391 interestperiod = put(pp, $MAP_PERIODS_UNIT10.);
--------------------
48
WARNING: Variable pp has already been defined as numeric.
21392 amortizationperiod = put(pp, $MAP_PERIODS_UNIT10.);
--------------------
48
WARNING: Variable pp has already been defined as numeric.
ERROR 48-59: The format MAP_PERIODS_UNIT was not found or could not be
loaded.
but I used
proc format library=rd_env.formats fmtlib;
select $Map_periods_unit;
run;
proc format library=rd_env.formats fmtlib;
select $Map_periods_mat;
run;
and returns
The SAS System
„ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ†
‚ FORMAT NAME: $MAP_PERIODS_UNIT LENGTH:
8 ‚
‚ MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 8
FUZZ: 0 ‚
‡ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ…ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ…
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ‰
‚START ‚END ‚LABEL (VER. 9.1
07AUG2008:19:43:17)‚
‡ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
‰
‚A ‚A
‚YEAR ‚
‚B ‚B
‚MONTH2 ‚
‚D ‚D
‚DAY ‚
‚M ‚M
‚MONTH ‚
‚N ‚N
‚ ‚
‚O ‚O
‚ ‚
‚Q ‚Q
‚QTR ‚
‚R ‚R
‚QTR3.2 ‚
‚S ‚S
‚SEMIYEAR ‚
‚W ‚W
‚WEEK ‚
‚**OTHER** ‚**OTHER**
‚ ‚
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ‹ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ‹ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŒ
The SAS System
„ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ†
‚ FORMAT NAME: $MAP_PERIODS_MAT LENGTH:
11 ‚
‚ MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 11
FUZZ: 0 ‚
‡ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ…ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ…
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ‰
‚START ‚END ‚LABEL (VER. 9.1
07AUG2008:19:14:17)‚
‡ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒˆƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
‰
‚A ‚A
‚1 ‚
‚B ‚B
‚0.166666667 ‚
‚D ‚D
‚0.002739726 ‚
‚M ‚M
‚0.083333333 ‚
‚N ‚N
‚. ‚
‚O ‚O
‚. ‚
‚Q ‚Q
‚0.25 ‚
‚R ‚R
‚0.333333333 ‚
‚S ‚S
‚0.5 ‚
‚W ‚W
‚0.019230769 ‚
‚**OTHER** ‚**OTHER**
‚. ‚
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ‹ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ‹ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŒ
What seems to be the problem?