From: Mark Sussman on
Hello all,

I have this import statement below and need to insert a decimal point
where there is non for the 7-digit variable COMP_RT_TA_CST_WRK and
the and the 9-digit variable amt. For example:

Variable
Original Needed
COMP_RT_TA_CST_WRK 0064020
64.020 (num)
AMT
000230472 0002304.72 (Char) ****needs to be char for
import eventually

Code:
DATA abbey.FPPScstwrk_final;
INFILE 'Z:\6204 Abbey\Data Received 2.17.2010\FPPScstwrk_final.txt';
INPUT
Name $ 0001-0038
SSN $ 0039-0047
RCD_TYP_CALC $ 0048
PRCS_PP 0049-0054
EFF_PP 0055-0060
WK_CD 0061
PAY_CD $ 0062-0064
HOURS $0065-0068
MINUTES $0069-0070
COMP_RT_TA_CST_WRK $0071-0077
AMT $0078-0086;
proc sort; by ssn eff_pp;
RUN;


Thanks

Mark
From: Jim Groeneveld on
Hi Mark,

One method (there are more solutions):

DATA ......;
SET .....;
* make numeric values;
COMP_RT_TA_CST_WRK_num = INPUT ( COMP_RT_TA_CST_WRK, 7.3 );
AMT__num = INPUT ( AMT, 9.2 );
* make new char vars that are 1 longer for the decimal point;
LENGTH COMP_RT_TA_CST_WRK_new $8 AMT_new $10;
* character representation of the numerical values;
COMP_RT_TA_CST_WRK_new = PUT ( COMP_RT_TA_CST_WRK_num, Z8.3 );
AMT_new = PUT ( AMT_num, Z10.3 );
RUN; * (always end a data step with RUN) ;

Regards - Jim
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
http://jim.groeneveld.eu.tf


On Tue, 2 Mar 2010 07:41:37 -0800, Mark Sussman <msussman(a)GMAIL.COM> wrote:

>Hello all,
>
>I have this import statement below and need to insert a decimal point
>where there is non for the 7-digit variable COMP_RT_TA_CST_WRK and
>the and the 9-digit variable amt. For example:
>
>Variable
>Original Needed
>COMP_RT_TA_CST_WRK 0064020
>64.020 (num)
>AMT
>000230472 0002304.72 (Char) ****needs to be char for
>import eventually
>
>Code:
>DATA abbey.FPPScstwrk_final;
>INFILE 'Z:\6204 Abbey\Data Received 2.17.2010\FPPScstwrk_final.txt';
>INPUT
>Name $ 0001-0038
>SSN $ 0039-0047
>RCD_TYP_CALC $ 0048
>PRCS_PP 0049-0054
>EFF_PP 0055-0060
>WK_CD 0061
>PAY_CD $ 0062-0064
>HOURS $0065-0068
>MINUTES $0069-0070
>COMP_RT_TA_CST_WRK $0071-0077
>AMT $0078-0086;
>proc sort; by ssn eff_pp;
>RUN;
>
>
>Thanks
>
>Mark
 | 
Pages: 1
Prev: assigning keys
Next: Compare 5 variables' values