The data step is building a control data set that is used in the proc format to build a format for the code variable. The name of the format we are building is called codelink. But that is beyond the scope of this example. We start by creating a temporary data set, pulling the one observation from storedat.movies which contains the code that is passed into this program as a parameter from the movies.sas program. Next we use proc append to combine the temporary data set with the data set that contains any previous selections the user has made, save.purchase.
All purchases go in the same data set.
We store the purchase data set in the save library. The save library is created when the session is started and the contents of each session s save library will be specific to that session. It is called cart.sas and the code looks like this. We sum on the price variable so the user can see the total of all his purchases. To be fully functional we would need to supply a way to edit or delete purchases.