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

Hello,

Could someone help to explain why the numeric values were not read correctly?   Thank you!  Yvonne

data id;

  input id best32.;

  format id 20.;

datalines;

2416303039498861622

2416303543869862689

2416307785486124532

2416309804262141822

; run;

proc print; run;

------output--------

Obs                     id

1     2416303039498861568
2     2416303543869862912
3     2416307785486124544
4     2416309804262141952

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Your ID field is too long for SAS to hold accurately as a number - around 15 digits is the maximum. For ID-type fields read these as character to fix your problem:

input id $20.;

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

Your ID field is too long for SAS to hold accurately as a number - around 15 digits is the maximum. For ID-type fields read these as character to fix your problem:

input id $20.;

Ying
Fluorite | Level 6

Thank you!

But I have other tables with numeric ID (length 20.), this table was from 3rd party.  Does  it mean I need to convert others to a character ID?  Not very efficient but if there is no choice.

SASKiwi
PROC Star

Unfortunately yes. In what form do you receive these tables? If they are delimited or fixed-length text files you may be able to read them in as character to begin with.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2149 views
  • 1 like
  • 2 in conversation