- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am exporting a SAS dataset as CSV file with the following code:
proc export data=data_new
outfile= path
dbms=csv
replace;
delimiter=';';
run;
The numbers in thousands in SAS data looks like: 25678.54678
However in csv file, it looks like: 2.567.854.678. So basically, in csv, the number is regarded as without decimals.
How can I fixed this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Does not happen:
data narf;
set sashelp.class;
Weight = Weight * 12345.67;
run;
proc export data=narf dbms=dlm outfile="export_sep_test.csv" replace;
delimiter=';';
run;
So please, run proc contents on the dataset and post the result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You may have an issue with formatting, because this works:
data data_new;
number = 25678.54678;
run;
filename out temp;
proc export data=data_new
outfile=out
dbms=csv
replace;
delimiter=';';
run;
data _null_;
infile out;
input;
put _infile_;
run;
Log excerpt:
110 data _null_; 111 infile out; 112 input; 113 put _infile_; 114 run; NOTE: The infile OUT is: Dateiname=/saswork/SAS_work95BE0000BA3C_odaws01-euw1.oda.sas.com/#LN00119, Besitzername=kurt.bremser,Gruppenname=oda, Zugriffsberechtigung=-rw-r--r--, Zuletzt geändert=12. April 2022 15.24 Uhr, Dateigröße (Byte)=19 number 25678.54678
The number is written to the file as intended.
Please run a PROC CONTENTS of your dataset data_new and post the output line for the variable that does not come out right.
How did you inspect your csv file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
this is how the column looks like in SAS:
When I open csv file, I see this:
Num | 8 | 20.5 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This is not what the file looks like. This looks rather like an Excel screenshot.
As I already said, do NOT (as in NOT) inspect the file with Excel. Open it with a text editor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please open the csv-file with a text editor, like notepad++. If excel shows formatting not meeting your expectations, than most likely excel applied one of its fantastic optimizations.