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
(840 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

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.