Hi guys,
I'm facing issue while converting SAS dataset to CSV. Character variable is converting to numeric in CSV file and missing trailing zeros. Below is the example.
SAS Dataset:
employy
1004.13100
1004.13140
1003.45620
after converting to CSV it is showing in numeric and missing trailing zeros
employy
1004.131
1004.1314
1003.4562
Need help. Appreciated
How do your export? Post your code please.
Here is the code
PROC EXPORT DATA= XXX
OUTFILE= "C:\temp\test.csv"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
How did you 'check' your file? If you opened it in Excel, Excel does it's own interpretation of the CSV. Make sure to check the output using a text editor such as Notepad++.
@anjankumar08 wrote:
Here is the code
PROC EXPORT DATA= XXX
OUTFILE= "C:\temp\test.csv"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
Hi,
It's showing correct in Notepad++
Thank you
@anjankumar08 wrote:
Why it is like this? Why it is not showing correct in CSV?
What application are you using to look at the CSV file?
If you opened the file with Excel, and possibly other spreadsheets, and then SAVED the file when closing then you may very well have permanently altered the contents. As @Reeza said.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.