Solved
Contributor
Posts: 60

# Update all cell in table based on conditions

Hi

How to update all cell in table based on value in cell no matters in which column they are?

data work;

input week pert sum tar west;

datalines;

18 200  8400 . 100

19 . 6970 6720 .

20 200 . 9766  .

21 .  8400 . 390

22 100 . 8400 .

;

run;

How to update (.) with (0) in whole table?

Thank you in advance

Bob

Accepted Solutions
Solution
‎08-28-2013 05:48 AM
Super Contributor
Posts: 312

## Re: Update all cell in table based on conditions

DATA WANT;

SET HAVE;

ARRAY NVARS _NUMERIC_;

DO I = 1 TO DIM(NVARS);

NVARS{I} = TRANSLATE(NVARS{I},0,.);

END;

RUN;

All Replies
Solution
‎08-28-2013 05:48 AM
Super Contributor
Posts: 312

## Re: Update all cell in table based on conditions

DATA WANT;

SET HAVE;

ARRAY NVARS _NUMERIC_;

DO I = 1 TO DIM(NVARS);

NVARS{I} = TRANSLATE(NVARS{I},0,.);

END;

RUN;

Super Contributor
Posts: 312

## Re: Update all cell in table based on conditions

Posted in reply to Scott_Mitchell

If you only want to change the presentation of the missing value, you could use the missing = option:

options missing='0';

data have;

input week pert sum tar west;

datalines;

18 200  8400 . 100

19 . 6970 6720 .

20 200 . 9766  .

21 .  8400 . 390

22 100 . 8400 .

;

run;

Contributor
Posts: 60

## Re: Update all cell in table based on conditions

Posted in reply to Scott_Mitchell

Hi Scoot

Thank you very much

Working like a charm.

Bob

Super Contributor
Posts: 312

## Re: Update all cell in table based on conditions

Glad I could help.

🔒 This topic is solved and locked.

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

Discussion stats
• 4 replies
• 291 views
• 6 likes
• 2 in conversation