BookmarkSubscribeRSS Feed
3 REPLIES 3
Reeza
Super User

You want a Match Merge.

 

The different methods of combining data sets are outlined here: 

http://documentation.sas.com/?docsetId=lrcon&docsetTarget=n1tgk0uanvisvon1r26lc036k0w7.htm&docsetVer...

 

And each section will have an example with data and code. 


@b384b7 wrote:

sas1.png


 

AndrewHowell
Moderator

This is an exercise from chapter 10 of @Ron_Cody's book Learning SAS(R) by Example:: A Programmer's Guide 

 

(The bicycle reference is also a dead giveaway.)

 

Can you not get the answer you are looking for in the book?

Ron_Cody
Obsidian | Level 7

Hi.

 

Here is the solution I used in the answers to the even numbered problems (available to teachers or self-learners who make a request to SAS).

 

data markup;
   input manuf : $10. Markup;
datalines;
Cannondale 1.05
Trek 1.07
;

proc sort data=learn.bicycles out=bicycles;
   by Manuf;
run;

data markup_prices;
   merge bicycles markup;
   by Manuf;
   NewTotal = TotalSales*Markup;
   format NewTotal dollar10.;
run;

title "Listing of MARKUP_PRICES";
proc print data=markup_prices noobs;
run;

 

By the way, I have just finished the second edition of the Learning SAS by Example book and the technical edits are due today.  I hope you will take a look at it.  All of the programs are up to date with the changes in SAS since the first edition was written.  The chapter on SAS Graph was replaced with one on PROC SGPLOT and a new chapter covering regular expressions was added.

 

Best,

Ron Cody

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1266 views
  • 2 likes
  • 4 in conversation