Help using Base SAS procedures

Using dif function followed by a where statement

Reply
New Contributor Roy
New Contributor
Posts: 2

Using dif function followed by a where statement

Hi guys,

First of all my apologies if this question is simple, but it was hard to search for similar questions.

I have a dataset like this:

abcountdif
666
191913
323213
919159
10510514
14314338
1441
17217228
19919927
27227242
32632654
35635630

Column count equals either a or b, whichever is not missing; while dif is simply the difference between each observation in count and its lag value. My desired output is this:

abcountdif
666
191913
919159
10510514
17217228
32632654
35635630

This is to say, I want to keep only observations where a is not missing, while keeping dif value as it was. But once I use where a ne .; the new dif adjusts itself automatically (e.g. row 3 becomes 72 rather than 59). Any suggestions would be greatly appreciated.

Cheers

Roy

New Contributor Roy
New Contributor
Posts: 2

Re: Using dif function followed by a where statement

Hi guys,

Please ignore this question. I just realised I can put the where statement in a separate procedure to make it work. Thanks.

Roy

Ask a Question
Discussion stats
  • 1 reply
  • 140 views
  • 0 likes
  • 1 in conversation