2

I need to create a lead variable in my data set in SAS.

I used the simple method:

proc expand data=data out=data_lead method = none; 
convert rate; 
convert rate = rate_lead5  / transformout=(lead 5); 
run;

But SAS required more resources (My data is about 220 GB)

Is there any simple way to create a 5-step-ahead variable without utilizing so much memory ? Thanks !

Tristan Sun
  • 289
  • 2
  • 5
  • 16

1 Answers1

1

As mentioned in my comment, take a look at Joe's answer to this question. However, if you only need to read each record 5 steps ahead (rather than 5 variables 1-5 steps ahead) then you can use his technique but without a macro by just doing:

data data_lead ;
  merge data data(firstobs=5 rename=(rate=rate_lead5)) ;
run ;
Community
  • 1
  • 1
Bendy
  • 3,506
  • 6
  • 40
  • 71