<?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: Macro Error? --- All variables in array list must be the same type? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865514#M341814</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;And since it is a data step it should be:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if caseid in ('E1' 'K8' 'R0' 'ER') then delete;&lt;/LI-CODE&gt;
&lt;P&gt;Comma is separator in SQL, in data step it is space.&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS does not care whether you use space or comma (or use both for that matter) as the delimiter in a list of value for the IN operator.&amp;nbsp; Does not matter whether the code is plain SAS code or PROC SQL code.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2023 17:38:13 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-03-21T17:38:13Z</dc:date>
    <item>
      <title>Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865504#M341805</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let i=(&amp;amp;rr + 1);
%let rr=%eval(&amp;amp;i);

proc sql;
create table inpcr&amp;amp;rr as
 select studysite,caseid,scrdate,inptadmitdt,inptdischargedt, intck('day',inptadmitdt, inptdischargedt) as c_los
 from ds2INP
 where scrdate ^=. and inptadmitdt ^=. and inptdischargedt ^=. and inptadmitdt ne '09SEP9999'd and inptdischargedt ne '09SEP9999'd
	   and (calculated c_los&amp;lt;0 or calculated c_los&amp;gt;100)
order by studysite,caseid;

%let inp_&amp;amp;rr.a=%str(Missing length of stay or extreme value [negative or &amp;gt;100 days]);

ods proclabel "Check &amp;amp;rr:&amp;amp;&amp;amp;&amp;amp;inp_&amp;amp;rr.a";

data inpcr&amp;amp;rr;
set inpcr&amp;amp;rr;
*if inptdischargedt='09SEP9999'd then delete;
var1="scrdate="||trim(left(put(scrdate,mmddyy10.)))
||', '||"inptadmitdt="||trim(left(put(inptadmitdt,mmddyy10.)))
||', '||"inptdischargedt="||trim(left(put(inptdischargedt,mmddyy10.))) 
||', '||"c_los="||trim(left(put(c_los,3.)));
format studysite studysite.;
/* site confirmed with checks */
if caseid in ('E1'.'K8','R0','ER') then delete;
run;

%createINP;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;MPRINT(ARIINPCHART):   data inpcr26;
MPRINT(ARIINPCHART):   set inpcr26;
MPRINT(ARIINPCHART):   *if inptdischargedt='09SEP9999'd then delete;
MPRINT(ARIINPCHART):   var1="scrdate="||trim(left(put(scrdate,mmddyy10.))) ||',
'||"inptadmitdt="||trim(left(put(inptadmitdt,mmddyy10.))) ||',
'||"inptdischargedt="||trim(left(put(inptdischargedt,mmddyy10.))) ||',
'||"c_los="||trim(left(put(c_los,3.)));
MPRINT(ARIINPCHART):   format studysite studysite.;
ERROR: All variables in array list must be the same type, i.e., all numeric or character.
MPRINT(ARIINPCHART):   if caseid in ('EH1R09181'.'EK1R01948','EK2R05147','ER1R01720') then delete;
MPRINT(ARIINPCHART):   run;

NOTE: The SAS System stopped processing this step because of errors.
&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865504#M341805</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-03-21T17:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865506#M341806</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;It looks like I still have an unsolving error in the codes.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865506#M341806</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-03-21T17:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865511#M341811</link>
      <description>&lt;P&gt;You have a dot(".") in your code instead a comma(","), should be:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if caseid in ('E1' , 'K8','R0','ER') then delete;&lt;/LI-CODE&gt;
&lt;P&gt;Bart&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865511#M341811</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-21T17:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865512#M341812</link>
      <description>&lt;P&gt;And since it is a data step it should be:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if caseid in ('E1' 'K8' 'R0' 'ER') then delete;&lt;/LI-CODE&gt;
&lt;P&gt;Comma is separator in SQL, in data step it is space.&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865512#M341812</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-21T17:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865513#M341813</link>
      <description>&lt;P&gt;When macros don't run, its not necessarily a macro error. This is a base SAS error in your code, not a macro error.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865513#M341813</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-21T17:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865514#M341814</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;And since it is a data step it should be:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if caseid in ('E1' 'K8' 'R0' 'ER') then delete;&lt;/LI-CODE&gt;
&lt;P&gt;Comma is separator in SQL, in data step it is space.&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS does not care whether you use space or comma (or use both for that matter) as the delimiter in a list of value for the IN operator.&amp;nbsp; Does not matter whether the code is plain SAS code or PROC SQL code.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:38:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865514#M341814</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-21T17:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865516#M341816</link>
      <description>&lt;P&gt;True, SAS&amp;nbsp;&lt;SPAN&gt;does not care &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865516#M341816</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-21T17:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865518#M341817</link>
      <description>&lt;P&gt;Maybe doesn't care but pays attention &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; &lt;SPAN class="lia-emoticons-autosuggestions"&gt;&lt;SPAN class="lia-emoticons-search-term"&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    data test1;
2      set test;
3      where X in &lt;STRONG&gt;("A" "B" "C")&lt;/STRONG&gt;;
4    run;

NOTE: There were 1 observations read from the data set WORK.TEST.
      WHERE X in ('A', 'B', 'C');
NOTE: The data set WORK.TEST1 has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


1    proc sql feedback;
2      create table test2 as
3      select *
4      from test
5      where X in ("A" "B" "C")
6      ;
NOTE: Statement transforms to:

        select TEST.x
          from WORK.TEST
         where TEST.x in&lt;STRONG&gt; ('A', 'B', 'C')&lt;/STRONG&gt;;

NOTE: Table WORK.TEST2 created, with 1 rows and 1 columns.

7    quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865518#M341817</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-21T17:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865519#M341818</link>
      <description>&lt;P&gt;The error message does not seem to have anything to do with the code around it.&amp;nbsp; There is no ARRAY statement there that I can see.&amp;nbsp; Is perhaps the actual source of the error earlier in the code somewhere?&amp;nbsp; Is SAS somehow not seeing the DATA statement as the start of a statement so the ARRAY statement it is talking about is actually earlier in the generated SAS code?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865519#M341818</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-21T17:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865522#M341820</link>
      <description>&lt;P&gt;Does the same thing with A&amp;lt;=B&amp;lt;=C&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865522#M341820</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-21T17:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865523#M341821</link>
      <description>&lt;P&gt;It is (as I wrote) the dot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    data test;
2      x="A";
3    run;

NOTE: The data set WORK.TEST has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


4
5    data test1;
6      set test;
7      if X in ("A"&lt;STRONG&gt; .&lt;/STRONG&gt; "B" , "C");
ERROR: All variables in array list must be the same type, i.e., all numeric or character.
8    run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST1 may be incomplete.  When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set WORK.TEST1 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:48:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865523#M341821</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-21T17:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Error? --- All variables in array list must be the same type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865524#M341822</link>
      <description>&lt;P&gt;My favourite is this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't use the maximum operator ("&amp;lt;&amp;gt;") in the WHERE clause because it is interpreted as "not equals" and SAS says:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1    data test;
2      x=1;y=0;output;
3      x=0;y=1;output;
4      x=1;y=1;output;
5      x=0;y=0;output;
6    run;

NOTE: The data set WORK.TEST has 4 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


7
8    data test1;
9      set test;
10     where X &amp;lt;&amp;gt; Y;
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "not equals".
11   run;

NOTE: There were 2 observations read from the data set WORK.TEST.
      WHERE X not = Y;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but... when you use "x max y" see what it writes:&lt;/P&gt;
&lt;PRE&gt;12
13   data test2;
14     set test;
15     where X max Y;
16   run;

NOTE: There were 3 observations read from the data set WORK.TEST.
      WHERE X&amp;lt;&amp;gt;Y;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Error-All-variables-in-array-list-must-be-the-same-type/m-p/865524#M341822</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-03-21T17:54:13Z</dc:date>
    </item>
  </channel>
</rss>

