Turn on suggestions

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

Showing results for

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 06-27-2014 08:10 AM
(850 views)

Hi, I would like to make such a version of this function 'mhatx1' which omits x=i from the sum i.e. computes t4

start mhatx1(m,p,h,pi,e);

t4=j(m,1);

do x=1 to nrow(p);

i=T(1:m);

temp1=x-i;

ue=Kmod(temp1,h,pi,e)#p*;*

le=Kmod(temp1,h,pi,e);

t4

end;

return (t4);

finish;

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If I understand your quetion, there are several ways to accomplish what you are asking. The method to choose depends on whether you want to modify the computation of ue and le, or just the sums.

Here are some functions that are good to know about:

- The REMOVE function. You can use this function if you want to remove certain elements from temp1. For example, the zero always occurs at the x_th position, so the following statement modifies temp1 so that it contains m-1 elements:

temp1=remove(x-i,x); /* exclude 0 from elements */ - The LOC function: Although it is not necessary here, you might need to find the indices of the elements tot satisfy some criterion before you can remove them. The LOC function enables you to find the elements. For details, see Finding data that satisfy a criterion - The DO Loop

I think the REMOVE function is all you need here.

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If I understand your quetion, there are several ways to accomplish what you are asking. The method to choose depends on whether you want to modify the computation of ue and le, or just the sums.

Here are some functions that are good to know about:

- The REMOVE function. You can use this function if you want to remove certain elements from temp1. For example, the zero always occurs at the x_th position, so the following statement modifies temp1 so that it contains m-1 elements:

temp1=remove(x-i,x); /* exclude 0 from elements */ - The LOC function: Although it is not necessary here, you might need to find the indices of the elements tot satisfy some criterion before you can remove them. The LOC function enables you to find the elements. For details, see Finding data that satisfy a criterion - The DO Loop

I think the REMOVE function is all you need here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you! That REMOVE was what I was looking for, even though I just ended up removing t'th solutions of the inner functions ue and le from summations:

start mhatx2(m,p,h,pi,e);

t5=j(m,1);

do x=1 to nrow(p);

i=T(1:m);

temp1=x-i;

ue=Kmod(temp1,h,pi,e)#p*;*

le=Kmod(temp1,h,pi,e);

t5

end;

return (t5);

finish;

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.