SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Numeric data converted to scientific notation in .CSV file

Reply
Frequent Contributor
Posts: 122

Numeric data converted to scientific notation in .CSV file

Hi All,

 

I am creating a .csv file in mainframe using SAS and email the file as an attachment. When I open the file the numeric data, for example, customer id 1234567898 is converted into 123E.11 something like that.

 

Could you please let me know how I can retain the format of the numeric variable in .CSV file( I know when I open the .csv file in Excel this weird conversion happens). 

 

Please help.

 

Thanks

Super User
Posts: 10,538

Re: Numeric data converted to scientific notation in .CSV file

Don't open in Excel, or make the columns wider the appearnce should change.. CSV does not have any format information in the file, it is only text.

Super User
Posts: 17,907

Re: Numeric data converted to scientific notation in .CSV file

Open the CSV in a text editor (Notepad/Wordpad) and verify the data. Excel is most likely making the conversion automatically. Very nice of it. Usually making the cell bigger will change the format to a number. You can also, try to make it a character variable and make sure you export it as a quoted variable and then Excel MAY read it properly. Not always...
Frequent Contributor
Posts: 122

Re: Numeric data converted to scientific notation in .CSV file

Hi All,

 

Thanks for the reponse.

 

Here is how I finally achieved retining the format of numeric variable in .CSV file.

 

data _null_;

 file filout;

 if _n_=1 then do;

  put @1 '="'

         @2 'Num variable'

         @10 '"';

end;

put @2 num_var;

run;

The above trick works!

Ask a Question
Discussion stats
  • 3 replies
  • 534 views
  • 0 likes
  • 3 in conversation