1
votes

I have a SQL that would create for each customer a short excerpt of his history. Suppose the columns I am interested in are TIMESTAMP and PURCHASE VALUE. I'd like to calculate a linear regression for each customer and put this value into a table.

proc sql;
   create table CUSTOMERHISTORY as
   select 
       TIME_STAMP
      ,PURCHASE_VALUE
      ,CUSTOMER_ID
   from <my data source>
;quit;

The table is quite large; it would be best, if the table wouldn't have to loaded into RAM prior to computation.

I tried

proc reg
   data = CUSTOMERHISTORY;
   model PURCHASE_VALUE=TIME_STAMP;
   outest = OUTTABLE;
   by CUSTOMER_ID;

but it never wrote anything to the OUTTABLE. (I found parameter outest in http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_reg_sect007.htm )

1

1 Answers

2
votes

According to the documentation you link to, outtest is a parameter that you should give as a option to proc reg. So to get that specific output, your code should look as:

proc reg
   data = CUSTOMERHISTORY
   outest = OUTTABLE;
   model PURCHASE_VALUE=TIME_STAMP;
   by CUSTOMER_ID;
run;

Note that there is no semicolon between data = ... and outtest = ....