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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 905 views
  • 0 likes
  • 2 in conversation