<?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: Including a where clause in process syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779465#M248248</link>
    <description>&lt;P&gt;I truly appreciate you all for jumping in and offering your assistance! Unfortunately, it seems this has gotten much too complicated, and my dataset isn't cooperating with your helpful suggestions. I think I will try a new route and create a secondary dataset that deletes the observations that I am attempting to exclude by means of my WHERE statement. If I delete these observations completely, I may be able to run the mediation syntax on the dataset with no issue.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 23:04:12 GMT</pubDate>
    <dc:creator>No_ABD_for_me</dc:creator>
    <dc:date>2021-11-09T23:04:12Z</dc:date>
    <item>
      <title>Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777511#M247372</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran the Preacher and Hayes mediation macro, which itself worked fine. Now I am trying to run mediation analyses on my dataset where PEDQ is the predictor, OGPA is the outcome, and dummy coded race variables, DEMO_GENDER, and EDLEVEL are covariates. I used the macro below, which worked fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%process (data = rs.t1, vars = pedq safe se ogpa dblack dlatino dasian dmixed demo_gender edlevel,
y=ogpa, x=pedq, m=safe se, model=4, total=1, contrast=1, normal = 1, percent=1, boot= 5000, conf=95);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this ran the analysis for the entire sample. I would like to run it on my analytic sample, which is obtained using the following WHERE statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;where pedq ne . and iai ne . and pals ne . and safe ne . and se ne . and ogpa ne . and ogpa ne 0.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, how do I merge the 2 syntax statements above? In essence, where would the WHERE statement fit in the mediation syntax?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 15:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777511#M247372</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-10-30T15:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777517#M247376</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not know that macro but I guess you can apply the where clause to your input data set like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%process (data = rs.t1(where=(pedq ne . and iai ne . and pals ne . and safe ne . and se ne . and ogpa ne . and ogpa ne 0.))
          , vars = pedq safe se ogpa dblack dlatino dasian dmixed demo_gender edlevel,
            y=ogpa, x=pedq, m=safe se, model=4, total=1, contrast=1, normal = 1, percent=1, boot= 5000, conf=95);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 16:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777517#M247376</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-10-30T16:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777519#M247378</link>
      <description>&lt;P&gt;Hi Koen&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply! That was a good idea, but unfortunately, it didn't work for me&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 16:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777519#M247378</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-10-30T16:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777633#M247429</link>
      <description>&lt;P&gt;Most likely SAS was confused by the extra brackets. How about this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%process (data = %str(rs.t1(where= %(pedq ne . and iai ne . and pals ne . and safe ne . and se ne . and ogpa ne . and ogpa ne 0.)) )
          , vars = pedq safe se ogpa dblack dlatino dasian dmixed demo_gender edlevel,
            y=ogpa, x=pedq, m=safe se, model=4, total=1, contrast=1, normal = 1, percent=1, boot= 5000, conf=95);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Nov 2021 01:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777633#M247429</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-11-01T01:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777647#M247433</link>
      <description>&lt;P&gt;Create a view that manages the WHERE, and use that for the data= parameter of the macro.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 08:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/777647#M247433</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-01T08:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779442#M248231</link>
      <description>&lt;P&gt;Sorry for the delay! Well, that certainly did something, even if not the intended result, so we may be headed in the right direction. I received a different error message this time&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-center" image-alt="Screen Shot 2021-11-09 at 4.33.16 PM.png" style="width: 466px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65543i228F4D05E8C7DFA1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-11-09 at 4.33.16 PM.png" alt="Screen Shot 2021-11-09 at 4.33.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779442#M248231</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-11-09T21:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779443#M248232</link>
      <description>Thanks for responding! I"m not sure I'm familiar with creating a view within SAS. How would I go about that?</description>
      <pubDate>Tue, 09 Nov 2021 21:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779443#M248232</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-11-09T21:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779446#M248235</link>
      <description>&lt;P&gt;Either&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data viewname / view=viewname;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create view viewname as
....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779446#M248235</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-09T21:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779448#M248237</link>
      <description>&lt;P&gt;Thank you. Does this look correct?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql;
create view viewname as rs.t1 (where pedq ne . and iai ne . and pals ne . and safe ne . 
and se ne . and ogpa ne . and ogpa ne 0.)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779448#M248237</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-11-09T22:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779456#M248241</link>
      <description>&lt;P&gt;Nope.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is better :&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;&lt;BR /&gt;create view viewname as &lt;BR /&gt;select *&lt;BR /&gt;from rs.t1 &lt;BR /&gt;where pedq ne . and iai ne . and pals ne . &lt;BR /&gt;and safe ne . and se ne . and ogpa ne . and ogpa ne 0&lt;BR /&gt;; QUIT;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779456#M248241</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-09T22:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779460#M248244</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391552"&gt;@No_ABD_for_me&lt;/a&gt;&amp;nbsp; - You are going to have to look through the SAS log to see what's causing those errors. Add this to the start of the program - OPTIONS MPRINT; - then rerun the macro to see the generated SAS code. That should give you more clues as to what is going on.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779460#M248244</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-11-09T22:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779464#M248247</link>
      <description>OK got it. When rerunning that with OPTIONS MPRINT at the beginning, here are the errors that came up in the log&lt;BR /&gt;&lt;BR /&gt;ERROR: Operand '*LIT1001'n does not have a value.&lt;BR /&gt;ERROR: (execution) Matrix has not been set to a value.&lt;BR /&gt;ERROR: (execution) Matrix has not been set to a value.&lt;BR /&gt;ERROR: (execution) Matrix has not been set to a value.&lt;BR /&gt;&lt;BR /&gt;Along with a host of other error messages that I am certain do not apply (e.g., "ERROR: You requested a model involving W but did not provide a valid W variable name." "ERROR: One of more of your M variables is not listed in the variables list.")</description>
      <pubDate>Tue, 09 Nov 2021 23:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779464#M248247</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-11-09T23:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779465#M248248</link>
      <description>&lt;P&gt;I truly appreciate you all for jumping in and offering your assistance! Unfortunately, it seems this has gotten much too complicated, and my dataset isn't cooperating with your helpful suggestions. I think I will try a new route and create a secondary dataset that deletes the observations that I am attempting to exclude by means of my WHERE statement. If I delete these observations completely, I may be able to run the mediation syntax on the dataset with no issue.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 23:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779465#M248248</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-11-09T23:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779466#M248249</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391552"&gt;@No_ABD_for_me&lt;/a&gt;&amp;nbsp;- Looks like you've got a problem with missing data values. You'll need to investigate and fix.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 23:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779466#M248249</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-11-09T23:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Including a where clause in process syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779469#M248252</link>
      <description>&lt;P&gt;It worked! I deleted the observations that would have been excluded by my WHERE statement using this syntax&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC SQL;
DELETE FROM rs.t1
WHERE pedq = .
;
QUIT;

PROC SQL;
DELETE FROM rs.t1
WHERE ogpa = .
;
QUIT;

PROC SQL;
DELETE FROM rs.t1
WHERE ogpa = 0
;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After the unwanted observations were removed, I ran the mediation syntax, and it worked beautifully on solely my analytic sample. Hoorah&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 23:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Including-a-where-clause-in-process-syntax/m-p/779469#M248252</guid>
      <dc:creator>No_ABD_for_me</dc:creator>
      <dc:date>2021-11-09T23:32:30Z</dc:date>
    </item>
  </channel>
</rss>

