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
SAS Super FREQ
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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1559 views
  • 0 likes
  • 2 in conversation