BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
i have

data report;
input dat tran;
format dat mmddyy8.;
cards;
10/12/98 45
10/16/98 66
10/26/98 23
11/06/00 89
11/20/00 75
11/23/00 45
11/29/00 63

Now i want the sum of tran between 10/12/98 to 10/16/98, and i want the sum of tran from 11/06/00 to 11/23/00 in to a new variable Total .if the trans is not between the mentioned dates it should remain same . Message was edited by: Main
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
A set of SAS assignment statements as illustrated below will work:

IF THEN ;
ELSE IF THEN ;
ELSE ;

Explore using SAS literal strings expressed as DATE values for your defined as explained in your post. The literal must be surrounded in either single- or double-quotes suffixed with a "D" character.

You have a wealth of SAS documentation and supplemental technical / conference papers available at the SAS support http://support.sas.com/ website using its SEARCH facility or with a GOOGLE search.

Scott Barry
SBBWorks, Inc.

Using SAS® Dates and Times – A Tutorial
Jonas V. Bilenas, JP Morgan Chase, Wilmington, DE
http://www2.sas.com/proceedings/forum2007/226-2007.pdf

Entering Dates
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001397901.htm

Working with Dates in the SAS System
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304321.htm

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 617 views
  • 0 likes
  • 2 in conversation