## DATA Step, Macro, Functions and more

Solved
Occasional Contributor
Posts: 5

Dear Friends and experts.

Good evening.

I could not solve this problem.

Sometimes it read correctly but this time it produce data like above.

Reading real numbers has no problem.

Accepted Solutions
Solution
‎07-09-2017 09:01 AM
Occasional Contributor
Posts: 5

## Re: When read integer 12, it errors to read like 0.000012

Dear guys,

My coding likes below;

Infile 'AA.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2;

Informat B1 Best12.6; Format B1 Best12.6;

Informat B2 Best12.6; Format B2 Best12.6;

input B1 B2;

run;

All Replies
Posts: 1,837

## Re: When read integer 12, it errors to read like 0.000012

post you code with your input data and you log.

SAS Super FREQ
Posts: 4,245

## Re: When read integer 12, it errors to read like 0.000012

Please provide a reproducible example. Are you reading data with an informat? Is this in the DATA step? Are you reading from a text file? An Excel spreadsheet? etc,

Super User
Posts: 23,773

## Re: When read integer 12, it errors to read like 0.000012

Use best12

If you're using something such as 8.3 it assumes you MUST always have 3 decimal points and reads it accordingly.

Super User
Posts: 8,125

## Re: When read integer 12, it errors to read like 0.000012

[ Edited ]

Most likely you have accidentally used an INFORMAT that includes .6 on the end. The meaning of the decimal part on a INFORMAT is different than the meaning of the decimal part on a FORMAT.  When a decimal part is specified on a INFORMAT it tells SAS where to put an implied decimal point when the input text does not have one. Basically it tells SAS how many powers of ten to divide integers by.

Try this example.

data have ;
input @1 normal 32. @1 wrong 32.6 ;
format _numeric_ 32.6 ;
cards;
12
12.34
0.000012
;
proc print;
run;

Solution
‎07-09-2017 09:01 AM
Occasional Contributor
Posts: 5

## Re: When read integer 12, it errors to read like 0.000012

Dear guys,

My coding likes below;

Infile 'AA.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2;

Informat B1 Best12.6; Format B1 Best12.6;

Informat B2 Best12.6; Format B2 Best12.6;

input B1 B2;

run;

Occasional Contributor
Posts: 5

## Re: When read integer 12, it errors to read like 0.000012

Thank you for your kind help.

It workd after I changed the informat and format of variable from Best12.6 to Best 12.

But would you let me know what to be careful when I use those formats.

best,

☑ This topic is solved.