<?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 Can you sort proc mi missing data patterns table? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949071#M371307</link>
    <description>&lt;P&gt;I am using SAS 9.4 and have a large data set with various missing data patterns. This is my first time exploring MI in SAS independently, so I ran the below code based on the user guide.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mi nimpute=0 data=a out=patterns;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produced a missing data patterns table with 57 different patterns.&amp;nbsp;&amp;nbsp;Is there a way to sort these patterns in the table, such as by frequency or percentage of pattern, or from least to most missing variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked through the user guide and could not find any specific option to do this. Also, it doesn't appear the output data set contains any observations to sort by.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems this would be helpful to identify patterns and think through approaches to imputation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2024 20:57:43 GMT</pubDate>
    <dc:creator>sasgorilla</dc:creator>
    <dc:date>2024-10-25T20:57:43Z</dc:date>
    <item>
      <title>Can you sort proc mi missing data patterns table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949071#M371307</link>
      <description>&lt;P&gt;I am using SAS 9.4 and have a large data set with various missing data patterns. This is my first time exploring MI in SAS independently, so I ran the below code based on the user guide.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mi nimpute=0 data=a out=patterns;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produced a missing data patterns table with 57 different patterns.&amp;nbsp;&amp;nbsp;Is there a way to sort these patterns in the table, such as by frequency or percentage of pattern, or from least to most missing variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked through the user guide and could not find any specific option to do this. Also, it doesn't appear the output data set contains any observations to sort by.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems this would be helpful to identify patterns and think through approaches to imputation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 20:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949071#M371307</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2024-10-25T20:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can you sort proc mi missing data patterns table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949077#M371311</link>
      <description>&lt;P&gt;You can get almost any output table into a data set though it may look a bit different than the displayed version.&lt;/P&gt;
&lt;P&gt;The generic skill is learning to use the ODS Trace to determine the name(s) of the created objects the procedure created. Then use that information to write and ODS OUTPUT statement.&lt;/P&gt;
&lt;P&gt;Or look up in the documentation for the procedure for the ODS Table Names shown in the Details tab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example with Proc freq since I don't have your data.&lt;/P&gt;
&lt;PRE&gt;ods trace on;

proc freq data=sashelp.class nlevels;
  tables sex*age / chisq;
run;

ods trace off;&lt;/PRE&gt;
&lt;P&gt;The LOG will show the created objects such as:&lt;/P&gt;
&lt;PRE&gt;Output Added:
-------------
Name:       NLevels
Template:   Base.Freq.NLevels
Path:       Freq.NLevels
-------------

Output Added:
-------------
Name:       CrossTabFreqs
Label:      Cross-Tabular Freq Table
Template:   Base.Freq.CrossTabFreqs
Path:       Freq.Table1.CrossTabFreqs
-------------

Output Added:
-------------
Name:       ChiSq
Label:      Chi-Square Tests
Template:   Base.Freq.ChiSq
Path:       Freq.Table1.ChiSq
-------------
&lt;/PRE&gt;
&lt;P&gt;So if I want to create data sets from the ods output:&lt;/P&gt;
&lt;PRE&gt;proc freq data=sashelp.class nlevels;
  tables sex*age / chisq;
  ods output nlevels=work.nlevelset
             crosstabfreqs= work.mycrosstab
             chisq = work.mychisq
  ;
run;
&lt;/PRE&gt;
&lt;P&gt;If you have a very large data set it is likely worth while to use the data set option OBS= to reduce the number of observations used by the procedure to reduce time for the procedure if you are running it only to get the table names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, proc freq will create an output data set for the crosstabs. But the ODS OUTPUT will allow placing multiple tables such as tables statement with : Tables (race age sex origin)*( q1 q2 q3 );&lt;/P&gt;
&lt;P&gt;Which would require 12 Tables statements to get the cross tabs for all 12 combinations of the variables requested.Ods output will place them all in one set with an indication of which table each row represents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 22:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949077#M371311</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-10-25T22:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can you sort proc mi missing data patterns table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949276#M371363</link>
      <description>&lt;P&gt;Thank you! I mimicked this and was able to reproduce the table I was after to sort and manipulate otherwise. Very helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 17:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-you-sort-proc-mi-missing-data-patterns-table/m-p/949276#M371363</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2024-10-28T17:02:54Z</dc:date>
    </item>
  </channel>
</rss>

