BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
3 REPLIES 3
Doc_Duke
Rhodochrosite | Level 12
Your request has multiple interpretations. Perhaps you could show what you wnt the ending dataset to look like.
deleted_user
Not applicable
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.

Thanks
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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 http://support.sas.com/ 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
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001302699.htm

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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