Thanks for your reply. Here is some more details of my code. I have the input data as following. data indat; input age; datalines; 34 42 30 ; run; I am going to write a macro, 'segment_var(indata, outdata, breaks, segvarprefix)', to outputs a dataset which has some new variables that indicates which segment the input value falls into. If using the dataset above and execute the macro %segment_var(indata = indat, outdata = outdat, breaks = 28 32 41 50, segvarprefix = ageseg_); I should get the output data, 'outdat', looking like age ageseg_28 ageseg_32 ageseg_41 ageseg_50 34 0 1 1 0 42 0 0 1 1 30 1 1 0 0
... View more