<?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 keep all observations in MACRO in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544748#M150659</link>
    <description>&lt;P&gt;'Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use the following MACRO codes, I only get the observations which can create a '&lt;CODE class=" language-sas"&gt;&amp;amp;COMPANY_NAME._inB' variable.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;do you know why I can not keep all observations?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Step9.Datastream_gb_Step3;
Set Step9.Datastream_gb_Step23;
Run;


%MACRO CompnayNameM(no=,Company_name=);

data Step9.Datastream_gb_Step3;
   format &amp;amp;Company_name._Step23 &amp;amp;Company_name._inB &amp;amp;Company_name._noB;
   set Step9.Datastream_gb_Step3;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/');
   start=1;
   call prxnext(RegExID, start, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
   &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /', -1, &amp;amp;COMPANY_NAME._Step23);
      do while (pos &amp;gt; 0);
   &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);
         output;
         call prxnext(RegExID, start, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
      end;
drop RegExID start pos length;
run;

%MEND CompnayNameM;

%CompnayNameM(no=1,Company_name=NAME)
%CompnayNameM(no=2,Company_name=COMPANY_NAME)
%CompnayNameM(no=3,Company_name=COMPANY_NAME_1)
%CompnayNameM(no=4,Company_name=COMPANY_NAME___SHORT)
%CompnayNameM(no=5,Company_name=PREVIOUS_NAME)
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2019 01:18:38 GMT</pubDate>
    <dc:creator>Alexxxxxxx</dc:creator>
    <dc:date>2019-03-21T01:18:38Z</dc:date>
    <item>
      <title>keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544748#M150659</link>
      <description>&lt;P&gt;'Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use the following MACRO codes, I only get the observations which can create a '&lt;CODE class=" language-sas"&gt;&amp;amp;COMPANY_NAME._inB' variable.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;do you know why I can not keep all observations?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Step9.Datastream_gb_Step3;
Set Step9.Datastream_gb_Step23;
Run;


%MACRO CompnayNameM(no=,Company_name=);

data Step9.Datastream_gb_Step3;
   format &amp;amp;Company_name._Step23 &amp;amp;Company_name._inB &amp;amp;Company_name._noB;
   set Step9.Datastream_gb_Step3;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/');
   start=1;
   call prxnext(RegExID, start, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
   &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /', -1, &amp;amp;COMPANY_NAME._Step23);
      do while (pos &amp;gt; 0);
   &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);
         output;
         call prxnext(RegExID, start, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
      end;
drop RegExID start pos length;
run;

%MEND CompnayNameM;

%CompnayNameM(no=1,Company_name=NAME)
%CompnayNameM(no=2,Company_name=COMPANY_NAME)
%CompnayNameM(no=3,Company_name=COMPANY_NAME_1)
%CompnayNameM(no=4,Company_name=COMPANY_NAME___SHORT)
%CompnayNameM(no=5,Company_name=PREVIOUS_NAME)
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 01:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544748#M150659</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-21T01:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544753#M150662</link>
      <description>&lt;P&gt;do you know why?&lt;/P&gt;
&lt;P&gt;I think that is the question to be answered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;look at your format&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 01:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544753#M150662</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-03-21T01:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544754#M150663</link>
      <description>Your output statement is inside the loop, which will never be entered if the pos is not greater than 0. You need to add an ELSE output.</description>
      <pubDate>Thu, 21 Mar 2019 01:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544754#M150663</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-21T01:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544825#M150679</link>
      <description>&lt;P&gt;Are you asking why some input observations are not reflected in the output dataset?&lt;/P&gt;
&lt;P&gt;Perhaps it is because of your DO/WHILE construct?&lt;/P&gt;
&lt;P&gt;Try switching to a DO UNTIL construct instead.&amp;nbsp; That way the first result is always output whether a match is found or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 12:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544825#M150679</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-21T12:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544876#M150693</link>
      <description>Dear VDD,&lt;BR /&gt;&lt;BR /&gt;thanks for your advice.&lt;BR /&gt;Could you please explain it in detail? I do not understand.</description>
      <pubDate>Thu, 21 Mar 2019 14:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544876#M150693</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-21T14:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544877#M150694</link>
      <description>Dear Reeza,&lt;BR /&gt;&lt;BR /&gt;thanks for your advice.&lt;BR /&gt;Could you please explain it in detail? Where should I add the ELSE output? I have added an example in attachment. Could you please have a look?</description>
      <pubDate>Thu, 21 Mar 2019 14:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544877#M150694</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-21T14:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544878#M150695</link>
      <description>&lt;P&gt;Dear Tom,&lt;/P&gt;&lt;P&gt;thanks for your advice.&lt;BR /&gt;Do you meaning&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data want;
Set Step9.Datastream_gb_Step23;
Run;


%MACRO CompnayNameM(no=,Company_name=);

data want;
   format &amp;amp;Company_name._Step23 &amp;amp;Company_name._inB &amp;amp;Company_name._noB;
   set want;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/');
   start=1;
   call prxnext(RegExID, start, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
   &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /', -1, &amp;amp;COMPANY_NAME._Step23);
      do until (pos &amp;gt; 0);
   &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);
         output;
         call prxnext(RegExID, start, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
      end;
drop RegExID start pos length;
run;

%MEND CompnayNameM;

%CompnayNameM(no=1,Company_name=NAME)
%CompnayNameM(no=2,Company_name=COMPANY_NAME)
%CompnayNameM(no=3,Company_name=COMPANY_NAME_1)
%CompnayNameM(no=4,Company_name=COMPANY_NAME___SHORT)
%CompnayNameM(no=5,Company_name=PREVIOUS_NAME)
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;, however, I get&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1470  %MEND CompnayNameM;
1471
1472  %CompnayNameM(no=1,Company_name=NAME)

NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
NOTE: Invalid third argument to function SUBSTR at line 2 column 193.
....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have added an example in attachment. Could you please have a look?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 14:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/544878#M150695</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-21T14:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/545033#M150743</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Dear Reeza,&lt;BR /&gt;&lt;BR /&gt;thanks for your advice.&lt;BR /&gt;Could you please explain it in detail? Where should I add the ELSE output? I have added an example in attachment. Could you please have a look?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you understand this code, or is it someone else's you're trying to modify?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a DO loop that only gets entered if POS is greater than 0. Your OUTPUT statement is in the DO loop. If you don't enter the DO loop you don't get any output. If you still need an output, you have to add a condition to deal with that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You really really should be commenting your code as well, it helps a lot, especially while learning.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 20:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/545033#M150743</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-21T20:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/545054#M150750</link>
      <description>&lt;P&gt;Clean up the logic a little. You can also eliminate the duplicate calls to search.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /'
      , -1, &amp;amp;COMPANY_NAME._Step23);
  pos=0;
  do n=1 by 1 until (pos = 0);
    call prxnext('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/'
       ,pos+1, length(&amp;amp;COMPANY_NAME._Step23), &amp;amp;COMPANY_NAME._Step23, pos, length);
    if pos=0 then call missing(&amp;amp;COMPANY_NAME._inB);
    else &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);
    if pos or n=1 then output;
  end;
  drop pos length;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not sure why you had the FORMAT statement and why it was BEFORE the SET statement?&lt;/P&gt;
&lt;P&gt;Also why were you reading and writing the same dataset?&amp;nbsp; That will make it hard to debug what is happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 21:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/545054#M150750</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-21T21:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547369#M151679</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;by the code, I get&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1453  %MACRO CompnayNameM(no=,Company_name=);
1454
1455  data step9.Patstat_gb_hrm_Step3;
1456    set step9.Patstat_gb_hrm_Step3;
1457    &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /', -1,
1457! &amp;amp;COMPANY_NAME._Step23);
1458    pos=0;
1459    do n=1 by 1 until (pos = 0);
1460      call prxnext('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/',pos+1, length(&amp;amp;COMPANY_NAME._Step23),
1460! &amp;amp;COMPANY_NAME._Step23, pos, length);
1461      if pos=0 then call missing(&amp;amp;COMPANY_NAME._inB);
1462      else &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);
1463      if pos or n=1 then output;
1464    end;
1465    drop pos length;
1466  run;
1467
1468  proc sql;
1469  create table PATSTAT&amp;amp;no. as
1470  select distinct
1471  &amp;amp;COMPANY_NAME.,
1472  &amp;amp;COMPANY_NAME._Step23,
1473  &amp;amp;COMPANY_NAME._inB,
1474  &amp;amp;COMPANY_NAME._noB
1475  from step9.Patstat_gb_hrm_Step3
1476  where &amp;amp;COMPANY_NAME._inB ne ''
1477  ;
1478  quit;
1479
1480  %MEND CompnayNameM;
1481
1482  %CompnayNameM(no=1,Company_name=HRM_L2)
NOTE: Line generated by the invoked macro "COMPNAYNAMEM".
1       data step9.Patstat_gb_hrm_Step3;   set step9.Patstat_gb_hrm_Step3;
1   ! &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /', -1,
1   ! &amp;amp;COMPANY_NAME._Step23);   pos=0;   do n=1 by 1 until (pos = 0);     call prxnext
                                                                               -------
                                                                               134
WARNING 134-185: Argument #2 is an expression, which cannot be updated by the PRXNEXT subroutine call.

NOTE: Line generated by the invoked macro "COMPNAYNAMEM".
2     ('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/',pos+1, length(&amp;amp;COMPANY_NAME._Step23),
       ---------------------------------------
       135
2   ! &amp;amp;COMPANY_NAME._Step23, pos, length);     if pos=0 then call missing(&amp;amp;COMPANY_NAME._inB);
2   ! else &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);     if

ERROR 135-185: Attempt to change the value of the constant '/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/' in
               the PRXNEXT subroutine call.

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      2:2     2:199
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set STEP9.PATSTAT_GB_HRM_STEP3 may be incomplete.  When this step was stopped there
         were 0 observations and 25 variables.
WARNING: Data set STEP9.PATSTAT_GB_HRM_STEP3 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds



ERROR: The following columns were not found in the contributing tables: HRM_L2_inB, HRM_L2_noB.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

1483  %CompnayNameM(no=2,Company_name=PERSON_NAME)


NOTE: Line generated by the invoked macro "COMPNAYNAMEM".
1      data step9.Patstat_gb_hrm_Step3;   set step9.Patstat_gb_hrm_Step3;
1   ! &amp;amp;COMPANY_NAME._noB=prxchange('s/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/ /', -1,
1   ! &amp;amp;COMPANY_NAME._Step23);   pos=0;   do n=1 by 1 until (pos = 0);     call prxnext
                                                                               -------
                                                                               134
WARNING 134-185: Argument #2 is an expression, which cannot be updated by the PRXNEXT subroutine call.

NOTE: Line generated by the invoked macro "COMPNAYNAMEM".
2     ('/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/',pos+1, length(&amp;amp;COMPANY_NAME._Step23),
       ---------------------------------------
       135
2   ! &amp;amp;COMPANY_NAME._Step23, pos, length);     if pos=0 then call missing(&amp;amp;COMPANY_NAME._inB);
2   ! else &amp;amp;COMPANY_NAME._inB = substr(&amp;amp;COMPANY_NAME._Step23, pos+1, length-2);     if

ERROR 135-185: Attempt to change the value of the constant '/&amp;lt;\w*&amp;gt;|\[\w*\]|\(\w*\)|"\w*"|''\w*''/' in
               the PRXNEXT subroutine call.

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      2:2     2:199
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set STEP9.PATSTAT_GB_HRM_STEP3 may be incomplete.  When this step was stopped there
         were 0 observations and 25 variables.
WARNING: Data set STEP9.PATSTAT_GB_HRM_STEP3 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds



ERROR: The following columns were not found in the contributing tables: PERSON_NAME_inB,
       PERSON_NAME_noB.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

1484  run;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;besides,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I face the value like&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;HARDY&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;FRNS&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'A'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it cannot be processed&amp;nbsp;by the code&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect to get&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;COMPANY_NAME_inB&lt;/TD&gt;&lt;TD&gt;COMPANY_NAME_noB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HARDY(FRNS.)'A'&lt;/TD&gt;&lt;TD&gt;FRNS.&lt;/TD&gt;&lt;TD&gt;HARDY&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HARDY(FRNS.)'A'&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;HARDY&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;However, I only get&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;COMPANY_NAME_inB&lt;/TD&gt;&lt;TD&gt;COMPANY_NAME_noB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HARDY(FRNS.)'A'&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;HARDY(FRNS.)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please give me some suggestions about these two problem?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Mar 2019 02:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547369#M151679</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-30T02:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547372#M151681</link>
      <description>&lt;P&gt;Because you only get to the Output statement if the RegEx returns a match.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Mar 2019 02:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547372#M151681</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-03-30T02:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547374#M151683</link>
      <description>Could you please explain it for me in detail?</description>
      <pubDate>Sat, 30 Mar 2019 02:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547374#M151683</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-30T02:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547377#M151686</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I start to feel that this is may-be one of these cases where one should first get the design approach right and only use macro coding if it can't be done with data steps and Proc's.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you post representative sample data (a tested SAS data step creating the data), show us the desired result for this sample data and then explain us what you're trying to implement/the logic from the have to the want data.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Mar 2019 03:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547377#M151686</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-03-30T03:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: keep all observations in MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547381#M151690</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Could you please explain it for me in detail?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, this was my answer to your initial question. I've missed all the discussion that already happened.&lt;/P&gt;
&lt;P&gt;But looking into your current code: It looks over complicated and I still believe instead of us trying to help you fix this code it would be better if you provide sample data, desired outcome and explanation what you want to achieve so we can help you to come up with a leaner and cleaner coding approach.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Mar 2019 03:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-all-observations-in-MACRO/m-p/547381#M151690</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-03-30T03:48:25Z</dc:date>
    </item>
  </channel>
</rss>

