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

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

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
  • 899 views
  • 0 likes
  • 2 in conversation