BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BETO
Fluorite | Level 6

The issue is I have a column with " On time" which displays 02/20/12  I used MONAME to  format to Month "Feb "which is great in my SAS table. The issue is when I export to excel it converts it back 02/20/12 . What can I do to keep the format of  Feb ? Thanks for your assitance

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

try something like

data all;

set all;

on_time_month=put(on_time,monname3.);

run;

Ksharp

View solution in original post

5 REPLIES 5
Haikuo
Onyx | Level 15

You probably need to convert it into character. Excel will not recognize SAS format.

Edit: something like:

data _null_;

a=input ('2/20/12', mmddyy8.);

b=put(a,monname3.);

put a b;

run;

Regards,

Haikuo

art297
Opal | Level 21

I agree we Haikuo.  Create a new variable to export.  e.g.:

data have;

  informat on_time mmddyy8.;

  input on_time;

  on_time_month=put(on_time,monname3.);

  cards;

02/20/12

03/14/12

;

BETO
Fluorite | Level 6

HI Art,

I've a table named 'All' it has 30 columns . Using your data step how would I tie it together  to convert  my date of 4000 entries  to reflect Month but keep the columns . I tried  rename my table to the data step  'Have' to ALL  an it removed the rest of the columns

Thanks again for your assitance in this matter

Ksharp
Super User

try something like

data all;

set all;

on_time_month=put(on_time,monname3.);

run;

Ksharp

art297
Opal | Level 21

The code that both Ksharp and I suggested would take care of it for all 4,000 of your records.  I'm not sure what you actually did, as you didn't post the code that you ran.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 1176 views
  • 4 likes
  • 4 in conversation