sas variable incorrect diaplay

Occasional Contributor
Posts: 13

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?



Super User
Posts: 12,316

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.;


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: 13

Re: sas variable incorrect diaplay

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

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;

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation