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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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