replace missing value in certain order

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 130
Accepted Solution

replace missing value in certain order

In the sample data, there are two variables, type and datanumber.

type have missing values when datanumber=1 to 41, 43, 45, 159, 259

How to:

=> by the variable 'datanumber', replace type's missing value with 'PARMS, STDERR, T, PVALUE, L95B, UP95B'.

(please refer to datanumber=42 or beyond for those type values' order; one thing worth to mention is that, datanumber=42 may not necessary the first one which don't have missing value in corresponding 'type', in other word, the first 'type' which don't have missing value is random)


Thanks!

Attachment

Accepted Solutions
Solution
‎08-17-2014 10:27 PM
Respected Advisor
Posts: 4,606

Re: replace missing value in certain order

Here is one way to do this:

data want;

do i = 1 by 1 until(last.datanumber);

    set have; by datanumber;

    type = choosec(i, "PARMS","STDERR","T","PVALUE","L95B","U95B");

    output;

    end;

drop i;

run;

PG

PG

View solution in original post


All Replies
Solution
‎08-17-2014 10:27 PM
Respected Advisor
Posts: 4,606

Re: replace missing value in certain order

Here is one way to do this:

data want;

do i = 1 by 1 until(last.datanumber);

    set have; by datanumber;

    type = choosec(i, "PARMS","STDERR","T","PVALUE","L95B","U95B");

    output;

    end;

drop i;

run;

PG

PG
Frequent Contributor
Posts: 130

Re: replace missing value in certain order

Thank you PGStats! that idea is quite straightforward.

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 176 views
  • 0 likes
  • 2 in conversation