BookmarkSubscribeRSS Feed
v9dduhan
Fluorite | Level 6

Hi,

 

I have made sas stored procedure and then transfered output to excel. But in excel preceding zero's are missing.

 

e.g.   value in sas                 value in excel

           005407                         5407

           001                               1

 

i have tried following code.

 

DEFINE SERIES_BASE / DISPLAY "SERIES BASE" Style(data)={tagattr='Format: @'} FORMAT= $CHAR4.;

 

DEFINE SERIES_BASE / DISPLAY "SERIES BASE" Style(data)={tagattr='Format: text'} FORMAT= $CHAR4.;

 

DEFINE SERIES_BASE / DISPLAY "SERIES BASE" Style(data)={tagattr='Format: $'} FORMAT= $CHAR4.;

 

I am getting error.

 

Can anyone please help.

 

Thanks in advance

 

2 REPLIES 2
Kurt_Bremser
Super User

Excel interprets any data cell that contains only digits as a number and formats accordingly. That's just Excel.

You might try adding a single quote before the leading zeroes.

For reference, please post your ODS statement(s) you used for the proc report.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

Your define should be - and do note whilst we are on the subject, follow some good coding practices - i.e. not all upper case or mixed case, use indentation etc. and there is a code window {i} above where you post for code.

define series_base / display "SERIES BASE" style={tagattr='Format:@'};

If that still persists you will need to post example test data in the form of a datastep and the code (formatted so it is readable) so we can have a look.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 864 views
  • 1 like
  • 3 in conversation