BookmarkSubscribeRSS Feed
Amali6
Quartz | Level 8

Hi

Could anyone help on how to create a new column(total) by adding the sum of two numerical variables(var1, var2) from the main table, using proc sql?

For example,

if i want to add var1 and var2 columns and name the new column as total, from work.project. 

 

Thanks

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Is this a serious question? 

 

proc sql;

 select *, sum(var1,var2) as total

from your_table;

quit;

 

Reeza
Super User

If you search any SAS topic and google and don't find the answer, search again and limit the results by adding the followings:  "yourTerm + Tutorial Site:Lexjansen.com

 

For 99% of topics you'll get a solution such as the following:

 

https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/257-30.pdf

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!

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
  • 2 replies
  • 474 views
  • 2 likes
  • 3 in conversation