<?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 Calling a character macro variable in a integrity constraint in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238388#M43799</link>
    <description>&lt;P&gt;Hi all. I been trying to call a character macro variable in an integrity constraint in Dataset procedure inside a macro. It is resolving to the correct string, but the results say " Add/Update failed for data set MCB.TABLE_PRODUCTS because data value(s) do&lt;/P&gt;
&lt;P&gt;not comply with integrity constraint aa_mes". However, all my observations have the character value of 201507&amp;nbsp;for the variable aa_mess.&amp;nbsp;The following is a sample of my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro table_prod(new1,set1,month1);
proc datasets library=&amp;amp;lib nolist;
 modify &amp;amp;new1;
   ic create fecha_proc = not null(fecha_proc);
   ic create aa_mes = check(where=(aa_mes = "&amp;amp;month1"));
   ic create id_clte = not null(id_clte);
   ic create Id_prod = not null(id_prod);
  run;

 append base=&amp;amp;lib..&amp;amp;new1 data=&amp;amp;lib..correct&amp;amp;set1;
 run;
quit;

%mend table_prod;

%table_prod(table_products,productos_201507,201507);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I may nto be writing the write code for call a character macro variable or maybe SAS is confused whether it is numeric or a character since it contains numbers. I'll be very appreciative if&amp;nbsp;anyone sees the error in the code that could help me fix my issue.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2015 21:58:10 GMT</pubDate>
    <dc:creator>mc</dc:creator>
    <dc:date>2015-12-08T21:58:10Z</dc:date>
    <item>
      <title>Calling a character macro variable in a integrity constraint</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238388#M43799</link>
      <description>&lt;P&gt;Hi all. I been trying to call a character macro variable in an integrity constraint in Dataset procedure inside a macro. It is resolving to the correct string, but the results say " Add/Update failed for data set MCB.TABLE_PRODUCTS because data value(s) do&lt;/P&gt;
&lt;P&gt;not comply with integrity constraint aa_mes". However, all my observations have the character value of 201507&amp;nbsp;for the variable aa_mess.&amp;nbsp;The following is a sample of my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro table_prod(new1,set1,month1);
proc datasets library=&amp;amp;lib nolist;
 modify &amp;amp;new1;
   ic create fecha_proc = not null(fecha_proc);
   ic create aa_mes = check(where=(aa_mes = "&amp;amp;month1"));
   ic create id_clte = not null(id_clte);
   ic create Id_prod = not null(id_prod);
  run;

 append base=&amp;amp;lib..&amp;amp;new1 data=&amp;amp;lib..correct&amp;amp;set1;
 run;
quit;

%mend table_prod;

%table_prod(table_products,productos_201507,201507);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I may nto be writing the write code for call a character macro variable or maybe SAS is confused whether it is numeric or a character since it contains numbers. I'll be very appreciative if&amp;nbsp;anyone sees the error in the code that could help me fix my issue.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238388#M43799</guid>
      <dc:creator>mc</dc:creator>
      <dc:date>2015-12-08T21:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a character macro variable in a integrity constraint</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238389#M43800</link>
      <description>What does a proc contents show for that variable, aa_mes?</description>
      <pubDate>Tue, 08 Dec 2015 22:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238389#M43800</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-08T22:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a character macro variable in a integrity constraint</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238391#M43801</link>
      <description>The variable aa_mes only has description of TYPE and LEN, which are Char and 7 respectively.</description>
      <pubDate>Tue, 08 Dec 2015 22:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238391#M43801</guid>
      <dc:creator>mc</dc:creator>
      <dc:date>2015-12-08T22:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a character macro variable in a integrity constraint</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238395#M43804</link>
      <description>7? You're providing a 6 char, try adding a trailing space to your comparison? You can also try your where comparison in a  data step and see if it works.</description>
      <pubDate>Tue, 08 Dec 2015 22:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238395#M43804</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-08T22:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a character macro variable in a integrity constraint</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238398#M43806</link>
      <description>&lt;P&gt;A trailing space wouldn't matter. I rather suspect a leading blank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does the output of the following step look like?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select distinct put(aa_mes, $hex14.)
from &amp;amp;lib..correctproductos_201507
where aa_mes ne '201507';
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Dec 2015 22:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238398#M43806</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-12-08T22:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a character macro variable in a integrity constraint</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238479#M43816</link>
      <description>&lt;P&gt;Not sure if I see the benefit&amp;nbsp;of using a check constraint&amp;nbsp;of something that easily can solve with a normal where-clause.&lt;/P&gt;
&lt;P&gt;Also, usually not too fond of physically separate&amp;nbsp;data by time period. Makes query much harder (unless you will use them as members&amp;nbsp;in a SPD Server cluster).&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 09:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-a-character-macro-variable-in-a-integrity-constraint/m-p/238479#M43816</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-12-09T09:48:45Z</dc:date>
    </item>
  </channel>
</rss>

