The SAS Output Delivery System and reporting techniques

How to create cross tab in SAS?

Reply
N/A
Posts: 0

How to create cross tab in SAS?

I have two datasets:

One, contains:
A
B
C

Two, contains:
1
2

How can I create a file like
A 1
A 2
B 1
B 2
C 1
C 2

Thanks!
SAS Super FREQ
Posts: 8,744

Re: How to create cross tab in SAS?

Hi:
This is not really a Base SAS or Reporting Procedure question (Print, Report, Tabulate). Although you can create cross-tabular REPORTS with SAS, using PROC FREQ, PROC REPORT or PROC TABULATE, you would need to have all your variables in one dataset first before you could create a cross-tab report.

What you want to do is join or merge your two files together to get all combinations of the variables in data set ONE with all combinations of the variables in data set TWO. This kind of join, when done with SQL, is called a "Cartesian product".

You might wish to consult either the PROC SQL documentation for information about the pros and cons of performing a Cartesian product join or the DATA step documentation for information on doing a MERGE without BY variables.

Otherwise, you might consider contacting Tech Support for help with this task, since, depending on the size of the files involved, you might need to choose a different technique to join your tables together.

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 472 views
  • 0 likes
  • 2 in conversation