Manuel Rivera
Manuel Rivera

Reputation: 1

Weird character variable dont convert to numeric

I have these txt New_Wireless_Fixed and when I read it using a data step, it reads the value for Sale/Funds but it does not convert it into numeric and when I try to clean it from other non-numeric character and then convert it, I only get missing values. I have been trying for two days and I can't make it work. Can someone told me what I am doing wrong and how can I fix it?

Data df;
    Infile 'C:\Users\psuphare\ASP\New_Wireless_Fixed.txt';     
    Input 
        @1  AcctNo      $13.
        @15 ActDt       MMDDYY10.
        @26 DeactDt     MMDDYY10.
        @41 DeactReason $4.
        @46 GoodCredit  8.
        @55 RatePlan    8.
        @65 DealerType  $2.
        @68 Age         8.
        @80 Province    $2.
        @85 Sale        COMMA8.2        
        ;    

Run;

This is the dataset: https://drive.google.com/file/d/1I2cmx9_HjIA7yzRUWg1axkmZjyrzL_yY/view?usp=sharing

Upvotes: 0

Views: 83

Answers (2)

Thank you guys. Sorry about the file in the google drive, it was the only way I thought for sharing the dataset. The problem is not that SAS is not reading the text file into a table, the problem is that when I try to use that variable (Sale, label Funds) in an aggregate function, it does not work because it says the function needs a numeric input.

Upvotes: 0

data _null_
data _null_

Reputation: 9109

I'll guess you need to use the INFILE statement option TERMSTR.

enter image description here

Upvotes: 1

Related Questions