turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Forecasting
- /
- Proc Expand replaces beginning missing values?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2016 10:52 AM

Hi --

I'd really appreciate help with this question if anyone has any suggestions.

I have a dataset that looks like this --

date Series1 Series2

1980 . 20

1981 . .

1982 10 15

1983 30 .

1984 25 19

1985 27 22

1986 . 25

1987 . 23

I want to be able to do the following --

a. Replace the two missing values (with zeros) for Series 2 for the years 1981 and 1983 (zero is a valid value for embedded missing values).

b. Replace the two missing values (with zeros) at the end for 1986 and 1987 for Series 1.

But, I DON'T want to replace the missing values for 1980 and 1981 for Series 1 since the series was yet to begin then (so, a zero would not be a valid value).

I've tried using Proc Expand to do it and here's the code --

Proc Expand data =year_ds out = year_ds1;

Id date;

convert series1 series2 / Transformin = (Setmiss 0);

Run;

The documentation says that Proc Expand only replaces embedded missing values i.e., it doesn't change beginning and ending missing values. So, the code above should only replace the embedded missing values for Series 2 (so, it shouldn't change the beginning and ending values for Series 1) but from what I'm seeing, the beginning and ending values (for Series 1) are being replaced with 0s as well -- so, all missing values in Series 1 and 2 are being replaced with 0s.

Any ideas would be greatly appreciated!

Thanks.

Accepted Solutions

Solution

08-11-2016
02:22 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2016 04:35 PM

try:

```
Proc Expand data =year_ds out = year_ds1 method=none;
Id date;
convert series1 series2 / Transformout = (setembedded (. 0) setright (. 0));
Run;
```

PG

All Replies

Solution

08-11-2016
02:22 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2016 04:35 PM

try:

```
Proc Expand data =year_ds out = year_ds1 method=none;
Id date;
convert series1 series2 / Transformout = (setembedded (. 0) setright (. 0));
Run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-11-2016 02:22 PM

Thanks so much -- that works!