Hi everyone,
I try to determine decimal digit of my variables which has fractional number. I have a sample data set as below and my desired output also as below. I don't want to round variiables's values, I just want to cut the decimal part when it comes 6th digit on decimal part.
Thank you,
Data Sample;
Input Fractional;
Datalines;
1.12345678
2.87654321
3.56781234
4.24135768
5
;
Run;
Data Want;
Set Sample;
Decimal=Round(Fractional,.000001);
Run;DESIRED
Not elegant, but simple and working:
Decimal=floor(Fractional*1000000)/1000000;
Thank you,
Could you give more information about 1e6, please?
Maybe the easiest is just to pick an appropriate fixed decimal format;
Data Sample; Input Fractional; put (Fractional Fractional Fractional) (f10.2 f10.4 f10.6); Datalines; 1.12345678 2.87654321 3.56781234 4.24135768 5 ; Run;
If you already have the data set and values then just use the desired format for print/report/ other procedure. Then the
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.