DATA Step, Macro, Functions and more

Calculate dates.

Not applicable
Posts: 0

Calculate dates.

Image i have a table like that:

cod date mov term_date begin_date
1 24MAY2009 0 . .
1 25MAY2009 1 . 25MAY2009
1 26MAY2009 0 . .
1 27MAY2009 2 . .
1 28MAY2009 0 . .
1 29MAY2009 1 29MAY2009 .
1 30MAY2009 1 . .

I want to extract the data set that is between the variable begin_date and term_date and to fill out it with the existent dates in the variable dates.

How can i do it? Thanks
Trusted Advisor
Posts: 2,125

Re: Calculate dates.

Posted in reply to deleted_user
Your request has multiple interpretations. Perhaps you could show what you wnt the ending dataset to look like.
Not applicable
Posts: 0

Re: Calculate dates.

Hi all,

I want this final dataset:

cod date mov term_date begin_date new_variable
1 25MAY2009 1 . 25MAY2009 25MAY2009
1 26MAY2009 0 . . 26MAY2009
1 27MAY2009 2 . . 27MAY2009
1 28MAY2009 0 . . 28MAY2009
1 29MAY2009 1 29MAY2009 . 29MAY2009

I try to use first and last procedure but i need to have this output at new_variable.

Super Contributor
Super Contributor
Posts: 3,176

Re: Calculate dates.

Posted in reply to deleted_user
Creating a new SAS variable is basic DATA step programming with SAS. What code, if any, have you tried? Can you share that code for feedback? If you need to assign a new variable, you can do so in a SAS DATA step and since the variable is a DATE, you will want to assign a FORMAT statement to the variable (or use a singe ATTRIB statement).

I have provided a SAS-hosted documentation link below -- also, the SAS support website has very useful information as technical and conference topic-related references, which you can find using the SEARCH facility.

Scott Barry
SBBWorks, Inc.

Introduction to DATA Step Processing
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation