BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
eun
Fluorite | Level 6 eun
Fluorite | Level 6

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.

Help me, please 

1 ACCEPTED SOLUTION

Accepted Solutions
eun
Fluorite | Level 6 eun
Fluorite | Level 6

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;

 

View solution in original post

6 REPLIES 6
Shmuel
Garnet | Level 18

post you code with your input data and you log.

Rick_SAS
SAS Super FREQ

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,

Reeza
Super User

Use best12

 

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

Tom
Super User Tom
Super User

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;

 

eun
Fluorite | Level 6 eun
Fluorite | Level 6

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;

 

eun
Fluorite | Level 6 eun
Fluorite | Level 6

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, 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 790 views
  • 4 likes
  • 5 in conversation