data your_data;
numeric_value = -1.825189E15;
run;
ods excel file="path/to/output.xlsx" ; proc report data=mydata ; columns _ALL_ ; run ; ods excel close ;
You could try ods excel in combination with e. g. proc report instead of proc export, but I am not sure if that will produce your desired result. Could you provide some example code and data?
Just run the code below and analize the csv file. You may need to change the filename statement.
filename csvfile '~/csvfile.csv' encoding=utf8;
data _null_;
file csvfile;
largenumber = -1825189000000000;
largenumber_fmt = largenumber;
format largenumber_fmt comma32.;
put "not formatted " largenumber=;
put "format comma32. " largenumber_fmt=;
largenumber + -9999999999999999;
largenumber_fmt = largenumber;
put "What if largenumber = largenumber + -9999999999999999?";
put "not formatted " largenumber=;
put "format comma32. " largenumber_fmt=;
positivelargenumber = 9007199254740992;
positivelargenumber_fmt = positivelargenumber;
format positivelargenumber_fmt comma32.;
put "not formatted " positivelargenumber=;
put "format comma32. " positivelargenumber_fmt=;
positivelargenumber + 1;
positivelargenumber_fmt = positivelargenumber;
put "What if positivelargenumber + 1?";
put "not formatted " positivelargenumber=;
put "format comma32. " positivelargenumber_fmt=;
run;
What FORMAT did you attach to the variable?
If you do not attach any format then SAS will use BEST12. Which is what it looks like was used.
To have it print all of those digits you will need to use the normal numeric format with a width of at least 17.
If you want it to print like the example in your question then you would need to attach the COMMA format. With a width of at least 22.
Note that if you do use the COMMA format then the CSV file will add quotes around the value to protect the embedded delimiters.
data have;
id +1 ;
input number ;
cards;
-1825189000000000
;
697 data _null_; 698 set have; 699 file log dsd ; 700 put id number; 701 put id number :17. ; 702 put id number :comma22. ; 703 run; 1,-1.825189E15 1,-1825189000000000 1,"-1,825,189,000,000,000" NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Use formats
There are lots of ways to export a dataset to CSV. Which are you using? Can you post a full, reproducible example? Something like:
data have ;
x= -1825189000000000 ;
run ;
*your code to export to CSV here ;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: