BookmarkSubscribeRSS Feed
AshokD
Obsidian | Level 7

Hi All,

 

I am trying export a dataset with employee_id field to CSV file. File was created but the last digit value is getting replaced with "0".

Ex:- In dataset , Employee_ID has value 8593217412 , when i export the data the value looks like 8593217410

 

SAS Code:-

ods csv file='LIST1.csv';
proc print data=work.TEST1;
run;
ods csv close;

 

Is there any solution for this ?

Please someone correct me where I'm wrong here.

 

Thanks

 

2 REPLIES 2
Kurt_Bremser
Super User

Please post a sample of work.test1 in a data step with datalines (see my footnotes).

ODS CSV is probably the least efficient way to create a csv file; proc export is a much better way to go, and writing your own data step the best.

ballardw
Super User

What FORMAT is currently assigned to your Employee_Id variable?

How are you examining the values in the CSV file? If using a spread sheet you might have a display that is rounding values for some reason and you should check the appearance in a plain text editor such as NotePad or even the SAS editor.

 

It would appear that your variable is numeric. ID variables that you are not doing arithmetic with should generally not be numeric but character.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 679 views
  • 0 likes
  • 3 in conversation