BookmarkSubscribeRSS Feed
merahilyana
Fluorite | Level 6

how to create new variable with calculation between 2 variables in same table.?

 

eg: In table population, If id = 1 and id=5 then count(people).

3 REPLIES 3
Reeza
Super User

It's not clear what you want. Are you adding a row or column?

Can you show an example of what you have and what you want?

 


@merahilyana wrote:

how to create new variable with calculation between 2 variables in same table.?

 

eg: In table population, If id = 1 and id=5 then count(people).


 

merahilyana
Fluorite | Level 6

Capture.JPG

 

bumiputera = 1 and warganegara = 5, want be like this:

 

Capture.JPG

Reeza
Super User
It looks like you're generating a report, so you should be using PROC REPORT and INDENT option to allow your values to be indented. PROC TABULATE also allows indents. If this doesn't answer your question, please post more details. Your above screenshots don't show much additional information, i have no idea what bumiputera=1 and warganegara = 5 mean.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 859 views
  • 0 likes
  • 2 in conversation