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

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

Posted 06-11-2014 05:29 AM
(939 views)

The matrix r is (2*t-1)*(2*t-1) but is it empty..may you help me?

Besides, I need to start the do from a negative number is this o.k.??

This is the program:

proc iml;

t=15;

a=2*t;

r=j(a-1,a-1,.);

do i= (1-t) to (t-1);

do j= (1-t) to (t-1);

az1= -(j-i);

az2= -(j-i);

bz1= -(j-i);

bz2= (j-i);

cz1= (j-i);

cz2= (j-i);

if j<0 then z1=az1;

z2=az2;

if j=0 then z1=bz1;

z2=bz2;

if j>0 then z1=cz1;

z2=cz2;

r[i,j]=probnorm(z2)-probnorm(z1);

end;

end;

print r;

quit;

Thanks in advance.

Waiting for your reply.

4 REPLIES 4

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

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

Thanks for your help.

I have just tried what you suggested. The matrix is now filled with numbers but they are not correct.

Why did you suggested putting (+t)?

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

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

Since we don't know what numbers are correct, you need to tell us what you expect or give an example for t=3.

The correctness of the program depends on z2 and z1. You can check their correctness with the following:

1) Outside the loop, allocate

Lower=j(a-1,a-1,.);

Upper=j(a-1,a-1,.);

2) Within the loop, define

Lower[i+t,j+t] = z1;

Upper[i+t,j+t] = z2;

3) Print Lower and Upper after the loop.

BTW, since the normal CDF is effectively zero when z<-6 and is 1 when z>6, you can probably get by with a smaller value of t. In any case, switch from PROBNORM(z) to CDF("Normal",z), as suggested at the end of this article: Six reasons you should stop using the RANUNI function to generate random numbers - The DO Loop

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer.

** **

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.