BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
LABRADOR
Obsidian | Level 7

Using SAS, how do I create a Joint Probability Table from this data table

 

  Undergraduate Major  
  Business Engineering Other Totals
Full Time 420 393 77 890
Part Time 399 593 44 1036
Totals 819 986 121 1926

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

That is a REPORT, not data.

You could make a dataset that has those numbers:

data summary ;
  length status $10 Department $20 ;
  input status &@ ;
  do department='Business','Engineering','Other';
     input count @;
     output;
  end;
cards;
Full Time	 420	393	77
Part Time	 399	593	44
;

What type of output do you want?

You can make a similar REPORT using PROC FREQ.

proc freq;
 tables status*department;
 weight count;
run;
The FREQ Procedure

Table of status by Department

status     Department

Frequency |
Percent   |
Row Pct   |
Col Pct   |Business|Engineer|Other   |  Total
          |        |ing     |        |
----------+--------+--------+--------+
Full Time |    420 |    393 |     77 |    890
          |  21.81 |  20.40 |   4.00 |  46.21
          |  47.19 |  44.16 |   8.65 |
          |  51.28 |  39.86 |  63.64 |
----------+--------+--------+--------+
Part Time |    399 |    593 |     44 |   1036
          |  20.72 |  30.79 |   2.28 |  53.79
          |  38.51 |  57.24 |   4.25 |
          |  48.72 |  60.14 |  36.36 |
----------+--------+--------+--------+
Total          819      986      121     1926
             42.52    51.19     6.28   100.00

 

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

That is a REPORT, not data.

You could make a dataset that has those numbers:

data summary ;
  length status $10 Department $20 ;
  input status &@ ;
  do department='Business','Engineering','Other';
     input count @;
     output;
  end;
cards;
Full Time	 420	393	77
Part Time	 399	593	44
;

What type of output do you want?

You can make a similar REPORT using PROC FREQ.

proc freq;
 tables status*department;
 weight count;
run;
The FREQ Procedure

Table of status by Department

status     Department

Frequency |
Percent   |
Row Pct   |
Col Pct   |Business|Engineer|Other   |  Total
          |        |ing     |        |
----------+--------+--------+--------+
Full Time |    420 |    393 |     77 |    890
          |  21.81 |  20.40 |   4.00 |  46.21
          |  47.19 |  44.16 |   8.65 |
          |  51.28 |  39.86 |  63.64 |
----------+--------+--------+--------+
Part Time |    399 |    593 |     44 |   1036
          |  20.72 |  30.79 |   2.28 |  53.79
          |  38.51 |  57.24 |   4.25 |
          |  48.72 |  60.14 |  36.36 |
----------+--------+--------+--------+
Total          819      986      121     1926
             42.52    51.19     6.28   100.00

 

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1241 views
  • 1 like
  • 2 in conversation