<?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: Some simple data management questions (missing values, subsetting) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72059#M20847</link>
    <description>Please still answer Paige's question but, if you need to identify records that have missing values AND you are using SAS 9.2, take a look at the cmiss function.&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
    <pubDate>Tue, 14 Sep 2010 19:49:10 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2010-09-14T19:49:10Z</dc:date>
    <item>
      <title>Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72055#M20843</link>
      <description>Hello all-&lt;BR /&gt;
&lt;BR /&gt;
Firstly, suppose I have a data set that has many variables with missing values and i want to only keep the observations with no missing values. Is there a way I can tell SAS to check all the variables in my data set as opposed to one at a time as in:&lt;BR /&gt;
&lt;BR /&gt;
data weight1;&lt;BR /&gt;
set weight;&lt;BR /&gt;
where (var1 ^=. AND var2^=. AND var3^=. etc);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Secondly, how can I add a new row of data to an existing dataset. For example, if I have a dataset and I want to add a new observation var1=x, var2=y, var3=z, etc., how can I do this?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Geo</description>
      <pubDate>Tue, 14 Sep 2010 17:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72055#M20843</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-14T17:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72056#M20844</link>
      <description>You can use the SUM function to add all the numeric variables in a row; if the result is missing, then all variables in the row are missing.&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
    set sashelp.class;&lt;BR /&gt;
    rowsum=sum(of _numeric_);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
You can add a new row with the OUTPUT statement in a SAS data step&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
    set sashelp.class end=eof;&lt;BR /&gt;
    output;&lt;BR /&gt;
    if eof then do;&lt;BR /&gt;
        age=14;&lt;BR /&gt;
        height=56;&lt;BR /&gt;
        weight=99;&lt;BR /&gt;
        output;&lt;BR /&gt;
     end;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 14 Sep 2010 18:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72056#M20844</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2010-09-14T18:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72057#M20845</link>
      <description>Paige-&lt;BR /&gt;
&lt;BR /&gt;
What if some of my variables are categorical and are missing?</description>
      <pubDate>Tue, 14 Sep 2010 18:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72057#M20845</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-14T18:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72058#M20846</link>
      <description>I don't really have a simple example in that case. Probably you need to use ARRAYs.&lt;BR /&gt;
&lt;BR /&gt;
But I have a question for you. Why make an effort to delete rows with all missing values? Leaving them in the data set doesn't hurt anything, does it?</description>
      <pubDate>Tue, 14 Sep 2010 18:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72058#M20846</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2010-09-14T18:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72059#M20847</link>
      <description>Please still answer Paige's question but, if you need to identify records that have missing values AND you are using SAS 9.2, take a look at the cmiss function.&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
      <pubDate>Tue, 14 Sep 2010 19:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72059#M20847</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-09-14T19:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72060#M20848</link>
      <description>One example with using CMISS and NMISS is demonstrated below, along with the special variable-type array references (all variables of a type).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
9    data _null_;&lt;BR /&gt;
10   retain a1 . a2 0 b1 'x' b2 'y';&lt;BR /&gt;
11   if cmiss(of _character_) then put 'char-yep';&lt;BR /&gt;
12   if nmiss(of _numeric_) then put 'num-yep';&lt;BR /&gt;
13   run;&lt;BR /&gt;
&lt;BR /&gt;
num-yep&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 14 Sep 2010 20:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72060#M20848</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-09-14T20:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72061#M20849</link>
      <description>Scott,&lt;BR /&gt;
&lt;BR /&gt;
I don't have 9.2, thus can't test it, but I was under the impression that CMISS handled BOTH numeric and character.  Thus, I would think that one could use:&lt;BR /&gt;
  CMISS (of _all_)&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
      <pubDate>Tue, 14 Sep 2010 20:41:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72061#M20849</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-09-14T20:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72062#M20850</link>
      <description>Thanks for the tip, Art - I tested it with SAS 9.2 and you are correct.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 14 Sep 2010 20:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72062#M20850</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-09-14T20:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72063#M20851</link>
      <description>Paige-&lt;BR /&gt;
&lt;BR /&gt;
I am working with the proc mixed statement doing a longitudinal analysis and I have missing data for some of my variables which are both continuous and categorical.&lt;BR /&gt;
&lt;BR /&gt;
I know proc mixed automatically removes the missing observations but I wanted to have a separate data set which contained all the non-missing values for procs that dont play nice with missing values (such as proc iml)&lt;BR /&gt;
&lt;BR /&gt;
Art and Scott-&lt;BR /&gt;
Thanks for the help. Here what I did and it worked out nicely:&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;data weight1;&lt;BR /&gt;
set weight1;&lt;BR /&gt;
if cmiss(of _all_) then miss='Y';&lt;BR /&gt;
else miss='N';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data nomiss;&lt;BR /&gt;
set weight1;&lt;BR /&gt;
where miss='N';&lt;BR /&gt;
drop miss;&lt;BR /&gt;
run;&lt;/B&gt;</description>
      <pubDate>Tue, 14 Sep 2010 22:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72063#M20851</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-14T22:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72064#M20852</link>
      <description>which can be shortened to&lt;BR /&gt;
&lt;BR /&gt;
data nomiss;&lt;BR /&gt;
set weight1;&lt;BR /&gt;
if cmiss(of _all_) then delete;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 15 Sep 2010 12:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72064#M20852</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2010-09-15T12:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Some simple data management questions (missing values, subsetting)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72065#M20853</link>
      <description>which, in turn, can be shortened to: &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
[pre]&lt;BR /&gt;
  data nomiss;&lt;BR /&gt;
    set weight1;&lt;BR /&gt;
    if ^cmiss(of _all_);&lt;BR /&gt;
  run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 15 Sep 2010 14:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Some-simple-data-management-questions-missing-values-subsetting/m-p/72065#M20853</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2010-09-15T14:29:23Z</dc:date>
    </item>
  </channel>
</rss>

