The SAS Output Delivery System and reporting techniques

sum by

Reply
N/A
Posts: 0

sum by

I want to know if you have table A
data A; /*var: age , note*/
age1 2
age2 5
age3 2
age4 4

well i want to create data B;
with :
data B;
ageA 7
ageB 6

by using data step
SAS Super FREQ
Posts: 8,868

Re: sum by

Posted in reply to deleted_user
Hi:
I don't see a correlation between table A and what you want in table B. Did you mean, perhaps that the data in A was:
[pre]
data A; /*var: age , note*/
ageA 2
ageA 5
ageB 2
ageB 4
[/pre]
OR
data A; /*var: age , note*/
age1 2 A
age2 5 A
age3 2 B
age4 4 B
[/pre]

It's hard to visualize the input data. And if you are talking about SUMBY, you're talking about PROC PRINT. If you're talking about using ageA and ageB as groups, then you're talking about PROC REPORT. So, I'm confused because you said you wanted to use the DATA step to get B -- is B a table or is B a report? Depending on what your INPUT data looks like (table A), the answer will depend on 1) the INPUT data and 2) what you want to get as output -- a table or a report.

And, if this is a DATA step program question and not an ODS/Reporting question, your best bet for help is to contact Tech Support.

cynthia
N/A
Posts: 0

Re: sum by

Posted in reply to Cynthia_sas
i mean:
i explain:
data A;
with 2 variables : age effectif
observations are:
age1 50
age2 75
age3 25
age4 10
age5 10
age6 5
.
.
agei
.
age99


i want to create data B
with variables gr_age effectif
and the first observation will be equal to: gr_age1 sum(age1-age4)
and the second will be equal to : gr_age2 sum (age5-age9)
......

data B
gr_age1 160
gr_age2 ..

after i want data B will be in a sheet of Excel

thanx
SAS Super FREQ
Posts: 8,868

Re: sum by

Posted in reply to deleted_user
This does not quite sound like an ODS question. It sounds to me like you want to sum every 4 or 5 observations? Or something like that. I think your best bet for a quick response might be to contact Tech Support:
http://support.sas.com/techsup/contact/index.html

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 129 views
  • 0 likes
  • 2 in conversation