BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 594 views
  • 0 likes
  • 2 in conversation