DATA Step, Macro, Functions and more

Filling the missing dates in column

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Filling the missing dates in column

I would like to fill in for missing dates in the following data. Additionally, I would like to

keep the former value of the wt-variable on the filled in dates. The first part went well while I have

problems with the last step. Variations over lags have not worked */

 

Attachment

Accepted Solutions
Solution
‎01-04-2017 03:27 PM
Super User
Posts: 11,343

Re: Filling the missing dates in column

Using lags it best to make them unconditional. You have placed a lag cal within multiple IF clauses.

Better would be BEFORE all of the if:

 

Lagwt = Lag(wt);

then replace your

wt= lag(wt)

with

wt = lagwt;

and then drop the Lagwt variable.

 

Note that another function similar to lag is DIF.  So you can address Dif(daymonthyear) in the same manner as Lag, with the same warning about conditional use.

View solution in original post


All Replies
Solution
‎01-04-2017 03:27 PM
Super User
Posts: 11,343

Re: Filling the missing dates in column

Using lags it best to make them unconditional. You have placed a lag cal within multiple IF clauses.

Better would be BEFORE all of the if:

 

Lagwt = Lag(wt);

then replace your

wt= lag(wt)

with

wt = lagwt;

and then drop the Lagwt variable.

 

Note that another function similar to lag is DIF.  So you can address Dif(daymonthyear) in the same manner as Lag, with the same warning about conditional use.

Occasional Contributor
Posts: 6

Re: Filling the missing dates in column

Thanks! Worked well!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 188 views
  • 1 like
  • 2 in conversation