<?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: Running Little's MCAR macro (path problem - Mac OS) in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762626#M110</link>
    <description>&lt;P&gt;Thanks. This is what I see when I open the properties for my dataset. Which would be the path?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="No_ABD_for_me_0-1629396323606.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62743i38F314875625EF3C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="No_ABD_for_me_0-1629396323606.png" alt="No_ABD_for_me_0-1629396323606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Aug 2021 18:05:30 GMT</pubDate>
    <dc:creator>No_ABD_for_me</dc:creator>
    <dc:date>2021-08-19T18:05:30Z</dc:date>
    <item>
      <title>Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762607#M106</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am having difficulty with the SAS syntax for my dataset. I am attempting to run Little's MCAR test on my data using the code at the very bottom of this post. However, I am continuously seeing this result&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="No_ABD_for_me_0-1629393391066.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62740iAE128A05C9885B09/image-size/medium?v=v2&amp;amp;px=400" role="button" title="No_ABD_for_me_0-1629393391066.png" alt="No_ABD_for_me_0-1629393391066.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and this error message in the log "Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/rs.t1."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am thinking the issue lies in the path for the dataset. I have the dataset uploaded into the SAS ODA cloud (i.e., on the web browser) in the library &lt;EM&gt;rs&lt;/EM&gt;, and the name of the file is &lt;EM&gt;t1&lt;/EM&gt;. For reference, I am using a Mac OS. Can someone please help? #DissertationDesperation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mcartest;

/* SPECIFY FILE PATH FOR THE INPUT DATA */

%let datafile = "rs.t1"; 

/* SPECIFY INPUT DATA VARIABLE LIST */

%let varlist = pedq pals iai safe se ogpa;

/* SPECIFY VARIABLE SET FOR THE MCAR TEST */

%let testvars = pedq pals iai safe se ogpa;

/* SPECIFY THE MISSING VALUE CODE */
     						                       
%let misscode = -99;							                       
		   				      				   
/*******************************/
/* DO NOT ALTER THE CODE BELOW */
/*******************************/

data one;
	infile &amp;amp;datafile ;
	input &amp;amp;varlist;

%let numvars = %sysfunc(countw(&amp;amp;testvars));

array m[&amp;amp;numvars] &amp;amp;testvars ;
array r[&amp;amp;numvars] r1 - r&amp;amp;numvars ;

do i = 1 to &amp;amp;numvars;
	if m[i] = &amp;amp;misscode then m[i] = .;
end;
drop i;

do i = 1 to &amp;amp;numvars;
	r[i] = 1;
	if m[i] = . then r[i] = 0;
end;
drop i;

proc sort;
	by r1-r&amp;amp;numvars;

proc mi data = one nimpute = 0 noprint;
   	var &amp;amp;testvars;
	em outem = emcov;

proc iml;

use one;
read all var {&amp;amp;testvars} into y;
read all var {%do i = 1 %to &amp;amp;numvars; r&amp;amp;i %end;} into r;
use emcov;
read all var {&amp;amp;testvars} into em;

mu = em[1,];
sigma = em[2:nrow(em),];

/* ASSIGN AN INDEX VARIABLE DENOTING EACH CASE'S PATTERN */

jcol = j(nrow(y), 1 , 1);

do i = 2 to nrow(y);
	rdiff = r[i,] - r[i - 1,];
	if max(rdiff) = 0 &amp;amp; min(rdiff) = 0 then jcol[i,] = jcol[i - 1,];
	else jcol[i,] = jcol[i - 1,] + 1;
end;

/* NUMBER OF DISTINCT MISSING DATA PATTERNS */

j = max(jcol);

/* PUT THE NUMBER OF CASES IN EACH PATTERN IN A COL VECTOR M */
/* PUT THE MISSING DATA INDICATORS FOR EACH PATTERN IN A MATRIX RJ */

m = j(j, 1, 0);
rj = j(j, ncol(r), 0);

do i = 1 to j;									
	count = 0;
		do k = 1 to nrow(y);
			if jcol[k,] = i then do;
				count = count + 1;
			end;
			if jcol[k,] = i &amp;amp; count = 1 then rj[i,] = r[k,];
			m[i,] = count;
		end;
end;

/* COMPUTE D^2 STATISTIC FOR EACH J PATTERN */

d2j = j(j, 1, 0);

do i = 1 to j;

/* OBSERVED VALUES FOR PATTERN J */

yj = y[loc(jcol = i),loc(rj[i,] = 1)];

/* VARIABLE MEANS FOR PATTERN J */

ybarobsj = yj[+,]/nrow(yj);

/* D = P X Pj MATRIX OF INDICATORS (SEE P. 1199) */

Dj = j(ncol(y), rj[i,+], 0);

count = 1;
do k = 1 to ncol(rj);
	if rj[i,k] = 1 then do;
		Dj[k, count] = 1;
		count = count + 1;
	end;
end;

/* REDUCE EM ESTIMATES TO CONTAIN OBSERVED ELEMENTS */

muobsj = mu * Dj;
sigmaobsj = t(Dj) * sigma * Dj;

/* THE CONTRIBUTION TO THE D^2 STATISTIC FOR EACH OF THE J PATTERNS */

d2j[i,] = m[i,] * (ybarobsj - muobsj) * inv(sigmaobsj) * t(ybarobsj - muobsj);

end;

/* THE D^2 STATISTIC */

d2 = d2j[+,];

/* DF FOR D^2 */

df = rj[+,+] - ncol(rj);
p = 1 - probchi(d2,df);

/* PRINT ANALYSIS RESULTS */

file print;
put "Number of Observed Variables = " (ncol(rj)) 3.0;
put "Number of Missing Data Patterns = " (j) 3.0; put;
put "Summary of Missing Data Patterns (0 = Missing, 1 = Observed)"; put;
put "Frequency | Pattern | d2j"; put;
do i = 1 to nrow(rj);
  put (m[i,]) 6.0 "    | " @;
    do j = 1 to ncol(rj);
      put (rj[i,j]) 2.0 @;
  end;
    put " | " (d2j[i,]) 8.6;
end;
put;
put "Sum of the Number of Observed Variables Across Patterns (Sigma psubj) = " (rj[+,+]) 5.0; put;
put "Little's (1988) Chi-Square Test of MCAR"; put;
put "Chi-Square (d2)      = " (d2) 10.3;
put "df (Sigma psubj - p) =    " (df) 7.0;
put "p-value              = " (p) 10.3;

%mend mcartest;
%mcartest;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 17:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762607#M106</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-08-19T17:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762608#M107</link>
      <description>&lt;P&gt;Specify the fully qualified name of the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if the file is in your home directory the change could be as small as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let datafile = "~/rs.t1"; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just make sure the path is to where the file is on the server where SAS is running.&amp;nbsp; Not where a copy of the file might be on your Mac.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 17:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762608#M107</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-19T17:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762613#M108</link>
      <description>&lt;P&gt;Thanks so much for your prompt response. Can you provide some examples of servers so that I can be fully aware of your point of reference? I didn't download anything for this version of SAS, so there isn't any location where I can find SAS running other than on my web browser.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 17:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762613#M108</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-08-19T17:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762621#M109</link>
      <description>&lt;P&gt;If you are using a browser than most likely you are using SAS/Studio to submit your SAS code to the SAS server.&amp;nbsp; SAS/Studio has ways for you to upload files and ways for you to see the files in its user interface.&amp;nbsp; Once you upload the file check the properties of it and it should show you the full path the file that you can use.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 17:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762621#M109</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-19T17:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762626#M110</link>
      <description>&lt;P&gt;Thanks. This is what I see when I open the properties for my dataset. Which would be the path?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="No_ABD_for_me_0-1629396323606.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62743i38F314875625EF3C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="No_ABD_for_me_0-1629396323606.png" alt="No_ABD_for_me_0-1629396323606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 18:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762626#M110</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-08-19T18:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762631#M113</link>
      <description>&lt;P&gt;Your SAS code does not want a SAS dataset. It wants a text file it can read to create a SAS dataset.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you already have a SAS dataset then you will need different code.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 18:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762631#M113</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-19T18:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762648#M114</link>
      <description>&lt;P&gt;Oh, I see! So I would probably need to convert to a txt file from the dataset I have and then upload that. Thanks so much!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 18:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762648#M114</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-08-19T18:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762692#M117</link>
      <description>I haven't looked through the entire code but  assuming t1 is a SAS dataset &amp;amp; you have a SAS library named rs on SAS OnDemand for Academics - you can just modify your code a little bit:&lt;BR /&gt;1. Remove the quotation marks (") the %let datafile statement (%let datafile = rs.t1;)&lt;BR /&gt;2. Change the following code below where it says not to make changes:&lt;BR /&gt;data one;&lt;BR /&gt;	infile &amp;amp;datafile ;&lt;BR /&gt;	input &amp;amp;varlist;&lt;BR /&gt;change to &lt;BR /&gt;data one;&lt;BR /&gt;	set &amp;amp;datafile (keep = &amp;amp;varlist);&lt;BR /&gt;&lt;BR /&gt;Let me know if this works - I tested it on SASHELP.cars &amp;amp; it appeared to work&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Aug 2021 20:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/762692#M117</guid>
      <dc:creator>tom_grant</dc:creator>
      <dc:date>2021-08-19T20:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Running Little's MCAR macro (path problem - Mac OS)</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/763061#M119</link>
      <description>&lt;P&gt;Unfortunately, this didn't work on my dataset. However, converting to a txt file and then uploading that into my SAS before finding the path ("location") using the "properties" of the txt file was a success! Thanks so much!&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 16:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Running-Little-s-MCAR-macro-path-problem-Mac-OS/m-p/763061#M119</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-08-21T16:38:17Z</dc:date>
    </item>
  </channel>
</rss>

