<?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 Get obs without null values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542668#M149950</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Why this code is not working?(Taks is to&amp;nbsp;get observations without null values)&lt;/P&gt;
&lt;P&gt;Error "ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, &lt;BR /&gt;a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER. "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select cats('not missing(', name, ')')
    into :expression separated by " and "
    from dictionary.columns
    where libname = "WORK" and memname = "a";
quit;
%put &amp;amp;expression;


proc sql ; 
create table b  as 
select *
from a
where &amp;amp;expression.
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Mar 2019 06:50:12 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-03-13T06:50:12Z</dc:date>
    <item>
      <title>Get obs without null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542668#M149950</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Why this code is not working?(Taks is to&amp;nbsp;get observations without null values)&lt;/P&gt;
&lt;P&gt;Error "ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, &lt;BR /&gt;a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER. "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select cats('not missing(', name, ')')
    into :expression separated by " and "
    from dictionary.columns
    where libname = "WORK" and memname = "a";
quit;
%put &amp;amp;expression;


proc sql ; 
create table b  as 
select *
from a
where &amp;amp;expression.
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 06:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542668#M149950</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-03-13T06:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get obs without null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542669#M149951</link>
      <description>&lt;P&gt;In what part of your code is this error issued?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if your only task is to extract observations without any missing values, there are far better approaches such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data NoMissingValues;
  set Sashelp.Heart;
  if cmiss(of _ALL_)=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 07:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542669#M149951</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-13T07:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get obs without null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542672#M149953</link>
      <description>&lt;P&gt;Activate option "symbolgen", re-run the code and examine or post the log.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 07:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542672#M149953</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-13T07:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get obs without null values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542676#M149954</link>
      <description>&lt;P&gt;Start debugging your code from the top.&lt;/P&gt;
&lt;P&gt;Your first clue comes here:&lt;/P&gt;
&lt;PRE&gt;38         proc sql noprint;
39             select cats('not missing(', name, ')')
40             into :expression separated by " and "
41             from dictionary.columns
42             where libname = "WORK" and memname = "a";
NOTE: No rows were selected.
&lt;/PRE&gt;
&lt;P&gt;SAS library references and dataset names are always uppercase, so there can't be a memname of "a", it has to be "A".&lt;/P&gt;
&lt;P&gt;The next clue is&lt;/P&gt;
&lt;PRE&gt;44         %put &amp;amp;expression;
WARNING: Apparent symbolic reference EXPRESSION not resolved.
&amp;amp;expression
&lt;/PRE&gt;
&lt;P&gt;because SQL won't create the macro variable if no rows were found to match the where condition.&lt;/P&gt;
&lt;P&gt;As soon as you fix the first problem:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where libname = "WORK" and memname = "A"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;everything will start to work.&lt;/P&gt;
&lt;P&gt;See my example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards dlm=' ' dsd;
input a $ b;
cards;
A 1
B 
 .
C 4
;
run;

proc sql noprint;
    select cats('not missing(', name, ')')
    into :expression separated by " and "
    from dictionary.columns
    where libname = "WORK" and memname = "A";
quit;
%put &amp;amp;expression;


proc sql ; 
create table b  as 
select *
from a
where &amp;amp;expression.
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;27         data a;
28         infile cards dlm=' ' dsd;
29         input a $ b;
30         cards;

NOTE: The data set WORK.A has 4 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      
35         ;

36         run;
37         
38         proc sql noprint;
39             select cats('not missing(', name, ')')
40             into :expression separated by " and "
41             from dictionary.columns
42             where libname = "WORK" and memname = "A";
43         quit;
NOTE: PROZEDUR SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

44         %put &amp;amp;expression;
not missing(a) and not missing(b)
45         
46         
2                                                          Das SAS System                            08:44 Wednesday, March 13, 2019

47         proc sql ;
48         create table b  as
49         select *
50         from a
51         where &amp;amp;expression.
52         ;
NOTE: Table WORK.B created, with 2 rows and 2 columns.

53         quit;
&lt;/PRE&gt;
&lt;P&gt;and the resulting dataset:&lt;/P&gt;
&lt;PRE&gt;a    b

A    1
C    4
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;'s solution is to be preferred, of course.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 07:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-obs-without-null-values/m-p/542676#M149954</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-13T07:52:38Z</dc:date>
    </item>
  </channel>
</rss>

