New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Adi27
Calcite | Level 5

Is it possible to merge 2 data sets with different variable names for the same thing?

For example, my product sheet has a column product_id which is same as column product in reviews but im unable to join them due to different names. Is it possible to join the two tables.

 

/* Merge LowRatedProducts with Products to access prices */
data LowRatedProductsWithPrices;
merge LowRatedProducts (in=a) Qed.Products (in=b);
by product_id; 
if a and b;
run;

/* Print the low-rated products along with their prices */
PROC PRINT DATA=LowRatedProductsWithPrices;
title "Low-Rated Products and Their Prices";
RUN;

 

This shows an error because review doesn't have products_id but product.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
merge LowRatedProducts (in=a rename=(product=product_id)) Qed.Products (in=b);
by product_id;
--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26
merge LowRatedProducts (in=a rename=(product=product_id)) Qed.Products (in=b);
by product_id;
--
Paige Miller

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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