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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 3 replies
  • 644 views
  • 0 likes
  • 3 in conversation