<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: proc iml in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836294#M5873</link>
    <description>&lt;P&gt;can we find each subject which are less then -1.5 using the loc function&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I was thinking&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;small = loc(X[,1:4]&amp;lt;1.5 ;&amp;nbsp;&lt;BR /&gt;print (small) [c=varNames];&lt;/P&gt;</description>
    <pubDate>Sat, 01 Oct 2022 14:22:12 GMT</pubDate>
    <dc:creator>pransh</dc:creator>
    <dc:date>2022-10-01T14:22:12Z</dc:date>
    <item>
      <title>proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/835984#M5865</link>
      <description>&lt;P&gt;i was doing homework&amp;nbsp;&lt;/P&gt;&lt;P&gt;this are the questions for your reference.&lt;/P&gt;&lt;P&gt;I was struggling with q2 and q3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Read only the following variables into a matrix called CG: NACZZMS, NACCLMI, NACCZLMD,&lt;BR /&gt;NACCDFT, NACCAGEB.&lt;BR /&gt;2) Using loops, replace the missing codes 99 and -99 for the following neuropsychological scores:&lt;BR /&gt;NACZZMS, NACCLMI, NACCZLMD and NACCDFT&lt;BR /&gt;3) Calculate the mean of the scores: NACZZMS, NACCLMI, NACCZLMD and NACCDFT and name the&lt;BR /&gt;new variable “Cognition”&lt;BR /&gt;4) Identify the subjects who have mean cognitive score less than -1.5 (Note: SAS thinks that a missing&lt;BR /&gt;value is equal to –infinity)&lt;BR /&gt;5) Export the matrix of the row numbers of subjects from question 4 in a dataset called IMPAIRED.&lt;BR /&gt;6) Within IML, run a regression (proc REG) with the “Cognition” as the dependent variable and age as&lt;BR /&gt;the independent variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code which I have used is as follows, I could only solve question 1, I dont know how to approach question 2 and 3 .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help will be appriciated&lt;/P&gt;&lt;P&gt;libname in "E:\hw";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;varnames={"NACCZMMS" "NACCZLMI" "NACCZDFT" "NACCZLMD" "NACCAGEB"};&lt;BR /&gt;use in.exercise;&lt;BR /&gt;read all var varnames into cg;&lt;BR /&gt;print cg[c=varnames];&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 01:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/835984#M5865</guid>
      <dc:creator>pransh</dc:creator>
      <dc:date>2022-09-30T01:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836028#M5866</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;i was doing homework&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please give each of these questions a try and show us the code you have tried. To be honest, we're not going to do homework for you, but we will try to help you if you get stuck.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 10:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836028#M5866</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-09-30T10:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836031#M5867</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Using loops, replace the missing codes 99 and -99 for the following neuropsychological scores:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;NACZZMS, NACCLMI, NACCZLMD and NACCDFT&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Think about where these variables are in the CG matrix. They are in columns 1-4, right? So you can loop over the rows and columns and use an IF-THEN statement to detect whether any values are 99 or -99. If so, replace them with a SAS missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In developing computer programs, it is often useful to solve a small example before you tackle the larger problem. See if the following example helps you solve your problem. You will need to rewrite the program to use your matrix (CG) instead of the small example matrix:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
/* replace -99 and 99 with a missing value */
 X = {0 -99  1  2,
     99   3  4  5,
      6   7 99 -99};
do i = 1 to nrow(X);
   do j = 1 to 4;
      if X[i,j]= 99 | X[i,j]= -99 then 
         X[i,j] = .;
   end;
end;

print X;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Sep 2022 10:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836031#M5867</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-09-30T10:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836107#M5868</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;I corrected my code accordingly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname in "E:\Third sem MPH\BS 803\class 3\hw";&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;varnames={"NACCZMMS" "NACCZLMI" "NACCZDFT" "NACCZLMD" "NACCAGEB"};&lt;BR /&gt;use in.exercise;&lt;BR /&gt;read all var varnames into cg;&lt;BR /&gt;do i = 1 to nrow(cg);&lt;BR /&gt;do j = 1 to 4;&lt;BR /&gt;if cg[i,j]= 99 | cg[i,j]= -99 then&lt;BR /&gt;cg[i,j] = .;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;cognition=cg[:,];&lt;BR /&gt;print cognition cg[c=varnames];&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also took out the means for each col but in the question it has been asked to identify the subjects who have mean score less then -1.5, but here since i have taken out the means of each coloumn , is it impossible to take out to identify the subjects who have mean score less then -1.5&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 15:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836107#M5868</guid>
      <dc:creator>pransh</dc:creator>
      <dc:date>2022-09-30T15:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836275#M5869</link>
      <description>&lt;P&gt;Remark: Since&amp;nbsp;NACCAGEB is not used in this problem, the program will be simpler if you exclude the variable. Then you don't have to subset by columns 1:4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;3) Calculate the mean of the scores: NACZZMS, NACCLMI, NACCZLMD and NACCDFT and name the&amp;nbsp;new variable “Cognition”&lt;/EM&gt;&lt;BR /&gt;I think this says to compute the mean across the first four columns for each subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* NACZZMS NACCLMI NACCZLMD NACCDFT NACCAGEB */
cg = {0   .  1  2 23, 
      .   .  .  . 32,
      4   3  .  5 25,
      1   1  2  1 28};

/* for convenience, extract the first 4 columns */
X = cg[ ,1:4];      
cognition = X[ ,:]; /* mean for each subject */
print cognition;
smallCog = (cognition &amp;lt; 1.5 &amp;amp; cognition ^= .); /* 0/1 variable (or use loop) */
print cognition smallCog;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Oct 2022 10:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836275#M5869</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-10-01T10:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836294#M5873</link>
      <description>&lt;P&gt;can we find each subject which are less then -1.5 using the loc function&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I was thinking&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;small = loc(X[,1:4]&amp;lt;1.5 ;&amp;nbsp;&lt;BR /&gt;print (small) [c=varNames];&lt;/P&gt;</description>
      <pubDate>Sat, 01 Oct 2022 14:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836294#M5873</guid>
      <dc:creator>pransh</dc:creator>
      <dc:date>2022-10-01T14:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836335#M5874</link>
      <description>&lt;P&gt;Yes, you can use the LOC function to find the row numbers. Add this to the end of my last program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;idx = loc(smallCog);
print idx;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Oct 2022 00:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836335#M5874</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-10-02T00:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836424#M5875</link>
      <description>&lt;P&gt;oh got that.&lt;/P&gt;&lt;P&gt;and do u have an example where proc iml is used to run linear regression instead of proc reg&lt;/P&gt;</description>
      <pubDate>Sun, 02 Oct 2022 20:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836424#M5875</guid>
      <dc:creator>pransh</dc:creator>
      <dc:date>2022-10-02T20:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836492#M5876</link>
      <description>&lt;P&gt;The &lt;EM&gt;SAS/IML User's Guide&lt;/EM&gt;&amp;nbsp;discusses linear regression in the Tutorial:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/imlug/imlug_tutorial_toc.htm" target="_self"&gt;Tutorial: A Module for Linear Regression&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 10:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/proc-iml/m-p/836492#M5876</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-10-03T10:27:21Z</dc:date>
    </item>
  </channel>
</rss>

