0
votes

I have a value which is sum of product sales I want to add a column such as Sum(product_sales ) as Product sales There is a column called product_sales from the table 1 and also add a column PRoduct NAme There are no columns name product sales and product name I want to create them so that they are in the output :

Such that the output is : Product name. Product sales Bat 10 Ball 30 Please help me how to create the above output . Iam unsure on how to create columns with space in sas

1
Why would you want to use those as the NAME of the variable? You could put the specialized text in the LABEL of the variable. Then it will be easy to have those values displayed on reports without forcing the programmer to have to deal with goofy variable names.Tom

1 Answers

1
votes

Looks like you want to assign a LABEL to your new variable.

proc sql;
  create table want as 
    select product_name label='Product Name'
         , sum(product_sales) as product_sales label='Product Sales'
    from have
    group by product_name
  ;
quit;
proc print data=want label;
run;