The SAS Output Delivery System and reporting techniques

Problem reading correct format in Excel after using ODS?

Reply
Super Contributor
Posts: 319

Problem reading correct format in Excel after using ODS?

Hi, all:

 

I exported CSV file by using ODS.  However, Excel automaticlly remove ".0" and become integer.  I use the notepad to open CSV file, the numbe format are correct as ".0".    How to fix this problem?

 

data nhssfinal;
set yt.nhssfinal (keep= type formatted_value);
run;
ods csv file="E:\My SAS Files\NHSS2020.CSV";
style=minimal;
options missing="";
proc print data=nhssfinal;
run;
ods csv close;

Super Contributor
Posts: 319

Re: Problem reading correct format in Excel after using ODS?

Below are some example showned in CSV.

 

15O17
16O8
17O4.1
18O5.6
19O9.1
20O27.1
21O3.8
22O30.8
23O15.4
24O8.6
25O6.2
26O16.5
27O9.3
28O2.3
29O4.4
30O13.6
31O4
32O20.6
33O5.9
34O21.3
35O15.1
36O1.6
37O9.8
38O8.2
39O6.8
40O11.7
41O8
42O16.2
43O3.5
44O14.5
45O18
46O4
47O1
48O12.3
49O7.6
50O4.6
51O4.2
52O1.4
53N47989
54N680
55N31
56N681
57N187
Super Contributor
Posts: 319

Re: Problem reading correct format in Excel after using ODS?

Due to CSV couldn't be uploaded from here.   I copy some error from I read in CSV format.  Please check the row 15,16,31,41,46,47.

Thanks.

Super User
Posts: 11,343

Re: Problem reading correct format in Excel after using ODS?

Name your CSV file with a TXT extension and it can be uploaded without problems.

 

If your CSV file has values with decimals like 5.0 and Excel removes them, that is an Excel issue.

 

Is your question related to seeing the deicimals in SAS?

 

Post how you read or import the CSV file.

 

Super User
Posts: 10,041

Re: Problem reading correct format in Excel after using ODS?

Add a TAB ( '09'x ) character or a single quote( ' ) before that numeric variable .
Ask a Question
Discussion stats
  • 4 replies
  • 430 views
  • 0 likes
  • 3 in conversation