BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

So I used EG 6.1 (with local SAS 9.4) and ran a simple program step to make an example file with one numeric and one character variable.

I then used both the interactive export and the export as a step in project flow to export the data set as a CSV.  The files were identical and both included the leading zeros.  Plus when I did the conversion as a step in the process flow then Enterprise Guide let be browse the created CSV file so that I could confirm that the leading zeros where there.

I also tried just attaching the Z2. format to the numeric variable with a FORMAT statement in the step that made the data and that also generated leading zeros in the CSV file.

I suspect that something down stream from SAS is removing the leading zeros for you.  For example if you double click on a CSV file and open it with Excel then Excel will convert anything that looks like a number to a number and leading zeros will be lost.  If the goal is to use this data with Excel then export it to an XLS or XLSX file instead of a CSV file.

CTorres
Quartz | Level 8

I think you need to review the information about SAS Variables. See  SAS(R) 9.4 Language Reference: Concepts, Fourth Edition.

There are only two types of variables in SAS: numeric and character. The numeric variables are stored in 8 bytes of memory in Float-Point internal representation (Machine)

The format in SAS allows different ways to present or display in reports (human) the value stored in a numeric variable which includes dates, datetimes and times. The format does not change in any way the numeric variable.

Ctorres

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 16 replies
  • 5861 views
  • 1 like
  • 6 in conversation