BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am again posting the same query
since am not getting the desired code

data is as follows
date meter demand cal;
1 A 5 5
2 B 10 15
3 C 15 30
4 D 20 50
5 E 25 75
6 F 30 105
7 G 35 140
8 H 40 180

in this table
there are three variables and "cal" is the result i require
so
i need the code such as i get the cumulative sum as shown in "Cal"
my input are date,meter(charachter) and demand and i need "cal" which
is shown in the table
and i need to sort it by meter and date
like for meter A (date 1 to 😎 its "cal"
then meter B (date 1 to 😎 its "cal"
so, please do reply if u have an answer for this query
thanks
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Explore the use (and output file) for PROC FREQ for this purpose. SAS generates variables with unique names (see the DOC) and so you need only to rename the output variable, if required.

Scott Barry
SBBWorks, Inc.

Base SAS(R) 9.2 Procedures Guide: Statistical Procedures, PROC FREQ
http://support.sas.com/documentation/cdl/en/procstat/59629/HTML/default/freq_toc.htm
Paige
Quartz | Level 8
In the data step where you read in the data, you need to add one simple command to compute cumulative demand;

CAL+DEMAND;
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
With the DATA step technique, there will be BY variable list and using IF FIRST. considerations - not the case when using the PROC approach.

Scott Barry
SBBWorks, Inc.

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