## Transforming a " . " into "missing"

Solved
Super Contributor
Posts: 454

# Transforming a " . " into "missing"

Hi,

Suppose I have the following SAS code:

data numbers;

input id name\$;

datalines;

1 A

2 B

3 A

4 .

5 B

6 .

7 B

8 A

9 A

10 .

;

run;

Some names are missing and I have the dot "." that signifies that these names are missing, but is it possible to have instead of the dot the actual word "Missing"?

Thank you

Accepted Solutions
Solution
‎12-17-2014 07:41 PM
Posts: 1,268

## Re: Transforming a " . " into "missing"

data numbers;

input id name\$;

if name=' ' then name='Missing';

datalines;

1 A

2 B

3 A

4 .

5 B

6 .

7 B

8 A

9 A

10 .

;

run;

All Replies
Solution
‎12-17-2014 07:41 PM
Posts: 1,268

## Re: Transforming a " . " into "missing"

data numbers;

input id name\$;

if name=' ' then name='Missing';

datalines;

1 A

2 B

3 A

4 .

5 B

6 .

7 B

8 A

9 A

10 .

;

run;

Super Contributor
Posts: 454

## Re: Transforming a " . " into "missing"

Thanks a lot stat@sas!

Super Contributor
Posts: 578

## Re: Transforming a " . " into "missing"

Isn't the value for name going to be a period? Shouldn't it be

if name='.' then name='Missing';

Posts: 3,810

## Re: Transforming a " . " into "missing"

```DBailey wrote:

Isn't the value for name going to be a period? Shouldn't it be
if name='.' then name='Missing';
```

No the \$ INFORMAT (variables A and C) reads dot as missing to accommodate list input which needs place holder.

data dot_or_not;
input a \$ @1 @;
input b \$char2. @1 @;
input c \$2. @1 @;
w=2;

input d \$varying2. w;

cards;
.  x
.  y
;;;;
run;
proc print;

run;

Super Contributor
Posts: 578

## Re: Transforming a " . " into "missing"

nice to know.  I'm figured that STAT wouldn't have made an error like that..but had to ask.

Posts: 1,268

## Re: Transforming a " . " into "missing"

Hi DBailey,

Thanks for highlighting this. I also learned as a result of your question from master data_null_.

Regards,

Naeem

Posts: 1,140

## Re: Transforming a " . " into "missing"

Alternatively by ifc function

data numbers;

input id name\$;

name=ifc(name='','Missing',name);

datalines;

1 A

2 B

3 A

4 .

5 B

6 .

7 B

8 A

9 A

10 .

;

run;

Thanks,

Jag

Thanks,
Jag
Super Contributor
Posts: 454