I have a small issue with my code :I am trying to create a data set that has 1)12 variables corresponding to each month, 2) that contain the price data for each combination of item and year.
my short datalines are year month item price 2008 1 bread 1.00 2008 2 bread 1.02 2008 3 bread 1.03
2008 1 Eggs 1.40 2008 2 Eggs 1.45 2008 3 Eggs 1.33
and so on for next five years 2009,2010,2011,2012 with 12 months and having milk as third item and have different prices for each month and each year,
my code is
data aveprices_latest;
set sasdata.have;
proc sort data=aveprices_latest;
byitem;
run;
proc means data=aveprices_latest;
class year;
by item;
var price;
run;
proc tabulate data=aveprices_latest;
class item Year Month;
var price;
table item*Year, Month*Price;
run;
My output is showing data table of averages, whereas I want the price data -not sums of the price data. I want to change the structure of the data table to make it have one column of data for each month.showing the combination of items and year.
Can you advise which part of my code need change?
... View more