An efficient way to Copying values in subsequent records - SAS

前端 未结 3 1495
陌清茗
陌清茗 2020-12-21 11:36

I have a dataset that is grouped by category variables in the source data. For example:

Bar  | Foo1
     | Foo2
     | Foo3
Bar2 | Foo4
     | Foo5
     | Fo         


        
3条回答
  •  礼貌的吻别
    2020-12-21 11:51

    You can retain the non-missing value and apply it to any missing values, e.g.

    data want ;
      set have ;
    
      length last $10. ;
      retain last '' ;
    
      if not missing(PARENT) then last = PARENT ;
      else PARENT = last ;
    
      drop last ;
    run ;
    

提交回复
热议问题