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


 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 740 views
  • 1 like
  • 2 in conversation