BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rogerjdeangelis
Barite | Level 11

filename fylfat "d:/txt/txtbig.txt" lrecl=16000 recfm=v;

* create the input fat file;
data sasfat;
        informat state $2. num1-num720 best21.;
        infile fylfat end=dne;
        input state $ num1-num720 ;
        output;
        if _n_=3 then stop;
run;quit;

proc print data=sasfat;
format num1-num720 21.17;
run;quit;

Norte SAS cannot handle 18 significat digits(you need R or Python for 18 sig digit arithmetic)

1.0021709654943634  Original number
1.0021709654943600  SAs number (lost precistion)

Obs  STATE                   NUM1                   NUM2  ...                  NUM720

 1    AK      1.00217096549436000    1.00414185896059000  ...     2.26668456775932000
 2    AL      1.00203845526359000    1.00408994140026000  ...     2.70441496537969000
 3    AR      1.00187083703867000    1.00367877037134000  ...     2.27810994554249000


Middle Observation(1 ) of sasfat - Total Obs 3

 -- CHARACTER --
STATE                            C    2       AK                  STATE


 -- NUMERIC --
NUM1                             N    8       1.0021709655        NUM1
NUM2                             N    8       1.004141859         NUM2
NUM3                             N    8       1.0059412003        NUM3
NUM4                             N    8       1.0075022638        NUM4
NUM5                             N    8       1.0089031672        NUM5
NUM6                             N    8       1.0103131154        NUM6
...
NUM717                           N    8       2.2575557326        NUM717
NUM718                           N    8       2.2610511943        NUM718
NUM719                           N    8       2.2640534503        NUM719
NUM720                           N    8       2.2666845678        NUM720


If you want to maintain precision you van use python (R does not have a native 64 bit integers)

Drop the decimal until last calc then add it with a format;

* there are extended precision packages in R and python;
* did not add the code to place the decimal you need a format;

%utl_submit_py64('
import numpy as np;
big1=np.int64(10021709654943634);
print(big1);
big1=np.int64(80000000000000008/4 );
print(big1);
');

1.0021709654943634
2.0000000000000002

Cynthia_sas
SAS Super FREQ

Ah, I see what  you mean.
cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 16 replies
  • 4902 views
  • 2 likes
  • 6 in conversation