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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

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