<?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: Saving Data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789111#M252466</link>
    <description>&lt;P&gt;No need to define arrays.&amp;nbsp; Just list the variables in CMISS() call.&lt;/P&gt;</description>
    <pubDate>Sun, 09 Jan 2022 04:11:56 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-01-09T04:11:56Z</dc:date>
    <item>
      <title>Saving Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/788968#M252390</link>
      <description>&lt;P&gt;I have run a logistic model. Total observations were 162K, and the final model used 62K due to missing values. How can I&amp;nbsp; save the number of observations used (62K) for the logistic model in SAS that includes all the variables used in the model?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 21:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/788968#M252390</guid>
      <dc:creator>salehrahman</dc:creator>
      <dc:date>2022-01-07T21:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/788971#M252393</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/411972"&gt;@salehrahman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have run a logistic model. Total observations were 162K, and the final model used 62K due to missing values. How can I&amp;nbsp; save the number of observations used (62K) for the logistic model in SAS that includes all the variables used in the model?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Am I understanding you properly? You want to save the number 62000 on every record in a SAS data set that contains all variables used? Doesn't really make sense to me. Could you explain further?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 22:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/788971#M252393</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-07T22:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/788985#M252404</link>
      <description>&lt;P&gt;If I thought I wanted only the data actually used by a model and knew that the reason observations were not used was due to missing I might be tempted to filter the data before running the model:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data formodel;
   set yourdatset;
   array _c (*) &amp;lt;list names of character variables in model goes here&amp;gt;;
   array _n (*) &amp;lt;list of names of numeric variables in model goes here&amp;gt;;
   if cmiss( of _c(*), of _n(*)) &amp;gt; 0 then delete;
run;&lt;/PRE&gt;
&lt;P&gt;Arrays are a way to reference similar variables for some purpose. Arrays can only hold character or numeric variables so if your model has both you would need to arrays. The Array is one way to write short code for functions that accept multiple variables you can use "of arrayname(*)" to use all the variables in the array.&lt;/P&gt;
&lt;P&gt;Or you could skip the array and list all of the variables. CMISS requires a comma separated list of names.&lt;/P&gt;
&lt;P&gt;CMISS will return how many of the variables are missing or 0 for none. So if the count is 0 the above code keeps the records that should have been used.&lt;/P&gt;
&lt;P&gt;I would rerun the model with the above set to see if you get the same results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Caveat: if you have records with missing dependent variable and are using the model output to get a predicted value make sure that you do not place the dependent variable in the above.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 23:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/788985#M252404</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-07T23:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789111#M252466</link>
      <description>&lt;P&gt;No need to define arrays.&amp;nbsp; Just list the variables in CMISS() call.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 04:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789111#M252466</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-09T04:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789312#M252560</link>
      <description>&lt;P&gt;You have not shown the code you ran so let's take an example from the documentation of PROC LOGISTIC.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=Neuralgia;
   class Treatment Sex;
   model Pain= Treatment Sex Treatment*Sex Age Duration / expb;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the dependent variable is PAIN and the independent variables are TREATMENT SEX AGE and DURATION.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make a subset of NEURALGIA that only includes the cases that have no missing values for any of those variables use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set Neuralgia;
  if 0 &amp;lt; cmiss(of Pain Treatment Sex Age Duration);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To see if you get the same answer run the same regression against the subset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=want;
   class Treatment Sex;
   model Pain= Treatment Sex Treatment*Sex Age Duration / expb;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jan 2022 18:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789312#M252560</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-10T18:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789315#M252563</link>
      <description>Wonderful. It works. I have 100K data now. I have to make sure all the variables are included. I did not run the logistics yet.</description>
      <pubDate>Mon, 10 Jan 2022 18:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-Data/m-p/789315#M252563</guid>
      <dc:creator>salehrahman</dc:creator>
      <dc:date>2022-01-10T18:37:52Z</dc:date>
    </item>
  </channel>
</rss>

