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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 3 replies
  • 1499 views
  • 1 like
  • 2 in conversation