0

I have a dataset on a portfolio and wanted to some segmentation in SAS. A portion of the dataset looks like the following:

ID Var1   Prod      Date      Balance

1    10       L1    Jul-09        200  
1    10       L2    Aug-09        300  
2    5      L1.1    Aug-09       -150  
2    5        L3    Sep-09        200  

I want to create segmentation based on values from Prod (e.g. L1, L2, etc). Any suggestions?

Andrew Haynes
  • 2,612
  • 2
  • 20
  • 35
user2641784
  • 377
  • 3
  • 5
  • 13

2 Answers2

0

Segmentation in the context you provided is a bit ambiguous. If by that you mean to create segmented datasets, each having observations associated with a unique value from Prod, you might be able to use the code from here:

/* define which libname.member table, and by which column */
%let TABLE=sashelp.cars;
%let COLUMN=origin;

proc sql noprint;
/* build a mini program for each value */
/* create a table with valid chars from data value */
select distinct 
   cat("DATA out_",compress(&COLUMN.,,'kad'),
   "; set &TABLE.(where=(&COLUMN.='", &COLUMN.,
   "')); run;") into :allsteps separated by ';' 
  from &TABLE.;
quit;

/* macro that includes the program we just generated */
%macro runSteps;
 &allsteps.;
%mend;

/* and...run the macro when ready */
%runSteps;
Hugs
  • 543
  • 2
  • 8
-1

I'm not familiar with segmentation, but can you use a class statement?

Jonathan Wilson
  • 626
  • 6
  • 14