Long numeric characters in SAS

When I try to convert a 10 digit number that is stored as 8. to a character using put (, 8.), it gives me the character value as something like 1.2345e10. I want the character string to be like 1234567890. Can someone help?

+4
source share
3 answers

8.is the width (number of characters) that you would like to use. So of course it is 1.2345e9; that it can fit in 8 characters.

x_char = put(x,10.);

, 10 . , 10. , (put(x,10. -l)), , .

, 8., , length; - , ( ). SBCS , length format .

+4

, , best.:

data have;
  x=1234567890;output;
  x=12345.67890;output;
  x=.1234567890;output;
  x=12345678901234;output;
run;

data want;
  set have;
  length ten best $32;
  ten=put(x,10.);
  best=put(x,best32.);
run;

, 10. , :

enter image description here

+2

SAS IEEE 64 . , , LENGTH 8, , 8 . 8, , , proc, 64 IEEE.

LENGTH, , , , , . FORMAT, . , .

So, if you know that your values ​​are always integers and the maximum value is 9999999999, then you can use the format 10.(also known as F10.).

charvar= put(numvar,F10.);
0
source

Source: https://habr.com/ru/post/1689399/


All Articles