BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Thalitacosta
Obsidian | Level 7

I have many variables in database called AT_1, AT_2, AT_3, ..., AT_599, AT_600, and I want to add them up and insert a variable in the same database called "sum_AT".

Variables:

AT_1 = 0 or 1,

.... ,

AT_600 = 0 or 1

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Here is a reference that illustrates how to refer to variables and datasets in a short cut list:
https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html

 

data want;
set have;
sum_at = sum(of AT1-at600);

run;

@Thalitacosta wrote:

I have many variables in database called AT_1, AT_2, AT_3, ..., AT_599, AT_600, and I want to add them up and insert a variable in the same database called "sum_AT".

Variables:

AT_1 = 0 or 1,

.... ,

AT_600 = 0 or 1


 

View solution in original post

1 REPLY 1
Reeza
Super User

Here is a reference that illustrates how to refer to variables and datasets in a short cut list:
https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html

 

data want;
set have;
sum_at = sum(of AT1-at600);

run;

@Thalitacosta wrote:

I have many variables in database called AT_1, AT_2, AT_3, ..., AT_599, AT_600, and I want to add them up and insert a variable in the same database called "sum_AT".

Variables:

AT_1 = 0 or 1,

.... ,

AT_600 = 0 or 1


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 695 views
  • 1 like
  • 2 in conversation