I'm doing the exercises from the SAS Programming 2 textbook.
I'm trying to convert this data:
Narrow Data set To a wide data-set like this:
Wide Data Set I'm also supposed to have an array in my data step and only output the variable customer_id and month1 through month12.
My code is the following:
Data customer_orders(keep=Customer_ID month1-month12);
set orion.order_summary;
by customer_id;
array month{12} month1-month12;
do i= 1 to 12;
if order_month = i then
month{i}= sale_amt;
end;
run;
proc print data=customer_orders;
run;
My problem when I run this code is that the observations does not display all of the sale_amt values for customer_id in one observation but instead skips to the next line to display the second value found in the observation.
Any help would be greatly appreciated.
Note: I'm not allowed to post another link to what my output looks like.