The SAS Output Delivery System and reporting techniques

reading character type numeric data with various decimal points

Reply
N/A
Posts: 0

reading character type numeric data with various decimal points

Hi,

I have a character field containing a mix of numeric and character data (ie. <20 0.555 4500 NA etc etc).

I want to select only numeric data and compare with a similar field for comparison. So I wrote:

IF VERIFY(EDRESULT,' 0123456789.') NE 0 THEN ;
ELSE DO;
IF INPUT(EDRESULT,8.2) < INPUT(EDLORNG,8.2) THEN EDFLAG = 'L';
ELSE IF INPUT(EDRESULT,8.2) > INPUT(EDHIRNG,8.2) THEN EDFLAG = 'H';
END;

But I'm not sure how format I should use to read in these data. Since it contains different decimal points, I can't just use one format (8.2). It gives a mix of correct and incorrect answers when I use this format.

Any idea?

Thank you.
James
SAS Employee
Posts: 88

Re: reading character type numeric data with various decimal points

Try using the BEST. format which allows SAS to choose the format providing the most information about the value.
N/A
Posts: 0

Re: reading character type numeric data with various decimal points

also simply using the informat 8. or 12. or... might be ok. You should not read with a format with decimal points in. If there comes something with decimals it is read ok anyway.
Ask a Question
Discussion stats
  • 2 replies
  • 162 views
  • 0 likes
  • 2 in conversation