- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi I have a large dataset consisting of 100 million rows, the data set has about 10 columns and 1 of the datasets has a number with about 10 decimal places, I would like to remove the decimal places to about 5 or 6 with out rounding up the number. I also want to keep all the other columns
Your help would be much appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you try changing the format? What format does it have?
Provide some sample data you have and your required result.
Suryakiran
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It will also round the number if you change format.
@zdassu, this topic has been covered quite a lot. See:
https://blogs.sas.com/content/sgf/2016/12/15/truncating-decimal-numbers-in-sas-without-rounding/
To see either a character or numeric version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
My Apologies for the late reply as I have been away for a few days. find sample data below, I would like to retain all fields
INV_NUMBER Year MONTH Ref RECON LDZ START_DATE END_DATE
1019894 2018 2 5477456 -40.749103617360840 SE 2017-07-01 2017-07-31
1019894 2018 2 5477456 -42.901859291503540 SE 2017-08-01 2017-08-31
1019894 2018 2 5606613 47.443779198665370 SE 2018-02-01 2018-02-03
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use floor function like below . Below is the example to consider 4 decimal places.
data test;
input i;
cards;
1.234567
;
run;
data test1;
set test;
i=floor(i*10000)/10000;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your reply, my apologies for late reply as I have been away, how would I use floor function and retain the other fields as well?
See sample data below
My Apologies for the late reply as I have been away for a few days. find sample data below, I would like to retain all fields
INV_NUMBER Year MONTH Ref RECON LDZ START_DATE END_DATE
1019894 2018 2 5477456 -40.749103617360840 SE 2017-07-01 2017-07-31
1019894 2018 2 5477456 -42.901859291503540 SE 2017-08-01 2017-08-31
1019894 2018 2 5606613 47.443779198665370 SE 2018-02-01 2018-02-03
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you check the blog @RW9 mentioned.
Something like this would work for you if your variable is numeric.
data have;
set have(rename=(RECON=RECON_));
RECON=INT(RECON_*100000)/100000;
run;
Suryakiran