sas variable incorrect diaplay

Reply
Occasional Contributor
Posts: 9

sas variable incorrect diaplay

Hello all!

 

I am new to sas and I am stumped with one of my numeric variables.

 

So, I have a variable name 'sampleid' which is 14 digits long- no space or dots or commas. When I imported my csv file to sas the sampleid of 020613020202021 looks like this: 2.02E+12. Can anyone help with that?

 

Thanks!

Super User
Posts: 11,343

Re: sas variable incorrect diaplay

Proc Import in addition to guessing variable types defaults to a "best" format for non-date or time variables.

You can get more digits displayed by assigning a format with more allowed digits such as best14. or F14.

 

Note that your variable is being treated as numeric so your leading zeroes would require a Z14. format to show them.

 

You can change the format a number of ways. Best is at reading.

 

Data mytable;

   set mytable;

   format sampleid z14.;

run;

is inefficient but simple. Proc datasets can modify formats of variables in place. Or the point-and-click on the table column header should allow setting the format.

Occasional Contributor
Posts: 9

Re: sas variable incorrect diaplay

Thank you thank you thank you Smiley Very Happy
It worked!!!
Super User
Super User
Posts: 7,059

Re: sas variable incorrect diaplay

If it is really an ID then you probably will want to read it as character instead of reading it as a number. 14 digits is close to the maximum integer that SAS can store uniquely in a numeric variable.

23    data _null_;
24      x=constant('exactint');
25      put x= comma24. ;
26    run;

x=9,007,199,254,740,992
Ask a Question
Discussion stats
  • 3 replies
  • 108 views
  • 0 likes
  • 3 in conversation