BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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!
1 REPLY 1
Cynthia_sas
Diamond | Level 26
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

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
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
  • 2104 views
  • 0 likes
  • 2 in conversation