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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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