DATA Step, Macro, Functions and more

Inserting Date Column - SAS enterprise Guide

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Inserting Date Column - SAS enterprise Guide

I have an existing SAS table and I want to add a date column to the table. Is there an easy way to add say JAN 2003? I am using SAS enterprise Guide. I have been going to Edit - Columns - Add Columns and adding the numeric value, however this is very cumbersome. It would be much easier to add just Jan 2003 and have SAS read it as a date.


Accepted Solutions
Solution
‎12-01-2015 11:39 AM
Super User
Posts: 17,750

Re: Inserting Date Column - SAS enterprise Guide

What numeric value? 15706? You can add a date value with a date literal as : "01Jan2003"d but that does mean including a day. You can then apply a format to display the date as desired.

View solution in original post


All Replies
Frequent Contributor
Posts: 110

Re: Inserting Date Column - SAS enterprise Guide

data new;

set old;

date=define date format as needed;

run;

 

Solution
‎12-01-2015 11:39 AM
Super User
Posts: 17,750

Re: Inserting Date Column - SAS enterprise Guide

What numeric value? 15706? You can add a date value with a date literal as : "01Jan2003"d but that does mean including a day. You can then apply a format to display the date as desired.

New Contributor
Posts: 4

Re: Inserting Date Column - SAS enterprise Guide

Thank you! I was missing the " "d.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 242 views
  • 0 likes
  • 3 in conversation