DATA Step, Macro, Functions and more

What approach to use in this problem?

Occasional Contributor
Posts: 13

What approach to use in this problem?


Super User
Posts: 23,951

Re: What approach to use in this problem?

You want a Match Merge.


The different methods of combining data sets are outlined here:


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

b384b7 wrote:



Posts: 329

Re: What approach to use in this problem?

[ Edited ]

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?

Occasional Contributor
Posts: 6

Re: What approach to use in this problem?

Posted in reply to AndrewHowell



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;
Cannondale 1.05
Trek 1.07

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

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

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


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.



Ron Cody


Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation