BookmarkSubscribeRSS Feed
NadiaK
Fluorite | Level 6

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!

3 REPLIES 3
ballardw
Super User

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.

NadiaK
Fluorite | Level 6
Thank you thank you thank you 😄
It worked!!!
Tom
Super User Tom
Super User

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

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1173 views
  • 0 likes
  • 3 in conversation