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
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Converts Missing values to Zero in SAS using Arra...

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

03-16-2012 05:13 AM

Dear All,

Is it possible, to write a program that converts missing values to zero and values of zero to missing for numeric variables using array statement?

Appreciate and thanks a lot for help.

Regards,

S Ravuri.

Accepted Solutions

Solution

03-16-2012
08:28 AM

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

03-16-2012 08:28 AM

S Ravuri,

It also "will be really helpful going forward" if you could mark Ksharp's answer as "Correct". One 'Click' of yours will help saving many others who share same interest many minutes by leading them right to the point. Besides, who would want to watch movies without endings at the first place?

Thanks,

Haikuo

All Replies

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

03-16-2012 05:27 AM

From mssing value to zero.

data worked; input _QueueName $24. _tran_dt :mmddyy8. _tran_tm acct_num workedkey _acct_num; format _tran_dt mmddyy8. acct_num 16.; cards; Inbound 3/8/2012 172000 3000000000064278 . 3000000000064278 C-VXX-D-CP-XXXXXXX-XXXX 3/7/2012 . 3000000000064278 11918651 3000000000064278 N-PXX-N-CP-XXXXXXXXXXXXX 3/3/2012 213400 2000000000885230 11886991 2000000000885230 N-2XX-N-KE-XXXXXXX 3/4/2012 170800 1000000000801180 11895835 1000000000801180 ; run; data worked; set worked; array _x{*} _numeric_; do i=1 to dim(_x); if missing(_x{i}) then _x{i}=0; end; run; From zero to missing value data worked; input _QueueName $24. _tran_dt :mmddyy8. _tran_tm acct_num workedkey _acct_num; format _tran_dt mmddyy8. acct_num 16.; cards; Inbound 3/8/2012 172000 3000000000064278 0 3000000000064278 C-VXX-D-CP-XXXXXXX-XXXX 3/7/2012 0 3000000000064278 11918651 3000000000064278 N-PXX-N-CP-XXXXXXXXXXXXX 3/3/2012 213400 2000000000885230 11886991 2000000000885230 N-2XX-N-KE-XXXXXXX 3/4/2012 170800 1000000000801180 11895835 1000000000801180 ; run; data worked; set worked; array _x{*} _numeric_; do i=1 to dim(_x); if _x{i}=0 then _x{i}=.; end; run;

Ksharp

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

03-16-2012 06:53 AM

Hello Ksharp,

Codes are worked very well and i really appreciate for your help.

If you don't mind, what is the significance of ** "_numeric_ " Automatic variable **which you used in the code ?

Can you please share if you have a list of Automatic variables in SAS with explanations and that will be really helpful going forward.

** **

**Regards,**

**S Ravuri.**

Solution

03-16-2012
08:28 AM

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

03-16-2012 08:28 AM

S Ravuri,

It also "will be really helpful going forward" if you could mark Ksharp's answer as "Correct". One 'Click' of yours will help saving many others who share same interest many minutes by leading them right to the point. Besides, who would want to watch movies without endings at the first place?

Thanks,

Haikuo

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

03-19-2012 03:43 AM

_numeric_ is a representor of all the numeric variables in this dataset.

There are some other variable listing way which can save you lots of time in the documentation.You should search it on your own at support.sas.com .

Ksharp

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

03-19-2012 06:02 PM

It's not an automatic variable. It is a SAS Variable List.

sambasiva.ravuri@tcs.com wrote:

Hello Ksharp,

Codes are worked very well and i really appreciate for your help.

If you don't mind, what is the significance of

which you used in the code ?"_numeric_ "Automatic variableCan you please share if you have a list of Automatic variables in SAS with explanations and that will be really helpful going forward.

Regards,

S Ravuri.

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

03-16-2012 09:06 AM

Haikuo,

Am already did that. Thanks for suggestion. Am between couple of meetings.So that is the reason am not able to do it on time and am sorry for that.

Regards,

S Ravuri.