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 07-05-2019 10:15 PM
(1671 views)

Hello I am trying to write this R code in IML is there an help on this

general.d <- function (m, s){

k=length(s)

m1_x = length (m)

sum.s = 0

for (i in 1:k){

sum.s = sum.s+s[i]^2

s_pooled=sqrt(sum.s/k)

}

if (m1_x==1 & k==1){

return (d=m/s)

}

else if (m1_x==2 & k==1){

m_1 = diff(m)

return(d=m_1/s_pooled)

}

else {

m_2 = max(m) - min(m)

return(d_2=m_2/s_pooled)

}

}

general.d <- function (m, s); k=length(s) m1_x = length (m) sum.s = 0 for (i in 1:k); sum.s = sum.s+s[i]^2 s_pooled=sqrt(sum.s/k) if (m1_x==1 & k==1); return (d=m/s); else if (m1_x==2 & k==1){ m_1 = diff(m); return(d=m_1/s_pooled); else { m_2 = max(m) - min(m); return(d_2=m_2/s_pooled); run; quit;

But I get an error code.

What I am doing wrongly I will be glad to receive help

8 REPLIES 8

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

So, we don't really need to see your R code. We do need to see your SAS code and the SAS log which contains the error (saying "But I get an error code" is never enough information).

So, please provide the entire SAS log for your IML (not just the error code) by clicking on the {i} icon (this is mandatory) and pasting your SAS log into the window that appears. Do not provide the SAS log any other way.

--

Paige Miller

Paige Miller

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

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

Okay, simple question ... there is an interface in PROC IML that allows you to run R code. Are you trying to run your exact R code inside of PROC IML?

Or are you trying to rewrite the R code as native PROC IML code (as your title implies)? You can't simply paste R code into PROC IML and expect it to run. The syntax used by R is completely different than the syntax used by PROC IML.

--

Paige Miller

Paige Miller

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

I am trying to rewrite the R code to Proc IML

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

Post it at IML forum @Rick_SAS might give you a hand .

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

* > I am trying to write this in IML is there any help on this?*

Yes, there are many resources for learning to program in SAS/IML. Start with "10 tips for learning the SAS/IML language."

You can also go straight to the *SAS/IML User's Guide.*

- 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

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

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.