DATA Step, Macro, Functions and more

Proc Export Excel retaining datetime format

Reply
Frequent Contributor
Posts: 131

Proc Export Excel retaining datetime format

USER_ID

EMAIL

LAST_LOGIN

USER_TYPE

SECURITY_GROUP

IS_ACTIVE

ACCOUNT_LOCKED

ACCOUNT_INACTIVE

xxxx

john.B.Iwoa@me.com

13Dec2016 12:01:00.000

1

LOS

Y

N

N

 

eeee

john.B.Iwoa@me.com

13Dec2016 11:02:00.000

1

LOS

Y

N

N

 

 

 

proc export data=Los_Prod_Logins

outfile="\\Corp\DFS\Mortgage_Shared\VA019\F01B\Everyone\MBIO_ADHOC_SHARED\Emp_Los_Prod\Dly_Loss_Prod_Login_&rptdate.xlsb"

dbms=ExcelCS replace;

server='GA016A744';

 

it exports to a shared drive as Dly_Loss_Prod_Login_20161213 where &rptdate reporesents the date

However when I export, I loose the datetime format which is needed for this particular report. I tried xls, xlsx, and xlsb format

Would I have to go with an ODS output delivery or is there a way to export directly to a share drive, keeping the datetime format. In this case LAST_LOGIN

 

Trusted Advisor
Posts: 1,394

Re: Proc Export Excel retaining datetime format

Use ODS excel tagattr  to assign excel format to the exported variable.

 

See pages 3-4 on:

http://support.sas.com/resources/papers/proceedings10/031-2010.pdf

 

Ask a Question
Discussion stats
  • 1 reply
  • 239 views
  • 0 likes
  • 2 in conversation