<?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: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28). in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268544#M53170</link>
    <description>&lt;P&gt;If I understand your question, I feed the macro from a dataset like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Pass parameters from dataset to the BuildQueryData macro. Calling the macro once for each rule record in the dataset ;
data _null_;
	set QueryRules;
	by rule_order;
	call execute('%BuildQueryData(analysis_desc='||analysis_desc||' , rule='||rule||' , rule_order='||rule_order||');');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 May 2016 14:24:20 GMT</pubDate>
    <dc:creator>buechler66</dc:creator>
    <dc:date>2016-05-05T14:24:20Z</dc:date>
    <item>
      <title>WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268527#M53160</link>
      <description>&lt;P&gt;Hi. When I run my macro below multiple times I get this SAS Warning. Is there something I can do to prevent this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Appending WORK.QUERYDATA to WORK.FINALDATA.
WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro BuildQueryData(analysis_desc= , rule= , rule_order= );
&lt;BR /&gt;	proc sql;
	create table QueryData as 
	(       select DISTINCT %str(%')&amp;amp;analysis_desc.%str(%') as RULE_NM, 
			b.actual_dlvry_date as AD_DT, 
			b.imb_code, 
			&amp;amp;rule_order as rule_order,
			b.spm_calc_batch_date
            from iv_ora.bi_spm_piece_recon a,  bids_ora.bi_spm_piece_recon b                                                                                                                                                                                                                                                                                                                                                                                                                                                   
            where a.spm_calc_batch_date = b.spm_calc_batch_date
              and a.imb_code = b.imb_code
            and &amp;amp;rule
	); 
	quit;

	* Append datasets to final dataset ;
	proc append base=FinalData
 	data=QueryData force;
	run;
&lt;BR /&gt;%mend BuildQueryData;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 14:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268527#M53160</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-05T14:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268530#M53162</link>
      <description>You can take control if what's being appended by using length= in the SQL select clause.</description>
      <pubDate>Thu, 05 May 2016 14:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268530#M53162</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-05T14:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268536#M53166</link>
      <description>&lt;P&gt;Well, my first question, as always, why do you need to do this in macro? &amp;nbsp;What is the benefit of it. &amp;nbsp;Where does the data come from to form those parameters? &amp;nbsp;The reason I ask is that a simple change to the process will elimiate all of this. &amp;nbsp;Rather than pwhy not roc sql creating a new table, which incidently you put no lengths o the variables - so allow SAS to guess the length from the max length of the string or 8 in character variables, which is why you get this mismatch, why not just insert new data into an existing table. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you going to use SQL, its worth finding out how it works and why it does things. &amp;nbsp;Now you haven't given any test data/required output to work with, so can't give any code really, but for example:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create MASTER_TABLE (VAR1 char(200),VAR2 num);
quit;

proc sql;
  insert into MASTER_TABLE
  select  ABC,DEF
  from    OTHER_DATA;
quit;&lt;/PRE&gt;
&lt;P&gt;Also if you have your parameter data in a dataset, ,then you don't need to do most of that code anyway, but its hard to say from wht you have provided.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 14:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268536#M53166</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-05T14:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268539#M53168</link>
      <description>Sounds promising. Can you point me to an example of this syntax?</description>
      <pubDate>Thu, 05 May 2016 14:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268539#M53168</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-05T14:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268544#M53170</link>
      <description>&lt;P&gt;If I understand your question, I feed the macro from a dataset like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Pass parameters from dataset to the BuildQueryData macro. Calling the macro once for each rule record in the dataset ;
data _null_;
	set QueryRules;
	by rule_order;
	call execute('%BuildQueryData(analysis_desc='||analysis_desc||' , rule='||rule||' , rule_order='||rule_order||');');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2016 14:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268544#M53170</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-05T14:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268545#M53171</link>
      <description>It's standard SQL, just check online doc Base SAS procedures.</description>
      <pubDate>Thu, 05 May 2016 14:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268545#M53171</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-05T14:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268556#M53173</link>
      <description>&lt;P&gt;Yes, so something like this. &amp;nbsp;First create an empty dataset, then each call of the macro insert the results into that dataset:&lt;/P&gt;
&lt;PRE&gt;%macro BuildQueryData(analysis_desc= , rule= , rule_order= );
	proc sql;
  	insert into QUERYDATA  
  	select distinct %str(%')&amp;amp;ANALYSIS_DESC.%str(%'), 
  			   B.ACTUAL_DLVRY_DATE, 
  			   B.IMB_CODE, 
  			   &amp;amp;RULE_ORDER.,
  			   B.SPM_CALC_BATCH_DATE
     from  IV_ORA.BI_SPM_PIECE_RECON A,
           BIDS_ORA.BI_SPM_PIECE_RECON B                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     where A.SPM_CALC_BATCH_DATE=B.SPM_CALC_BATCH_DATE
       and A.IMB_CODE=B.IMB_CODE
       and &amp;amp;RULE.); 
	quit;
%mend BuildQueryData;

proc sql;
  create table QUERYDATA
  (
    RULE_NM char(200),
    AD_DT num format=date9.,
    IMB_CODE char(200),
    ...
  );
quit;

data _null_;
	set QueryRules;
	by rule_order;
	call execute('%BuildQueryData(analysis_desc='||analysis_desc||' , rule='||rule||' , rule_order='||rule_order||');');
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2016 14:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268556#M53173</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-05T14:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268607#M53181</link>
      <description>&lt;P&gt;The first block of code is working with Length= statements, but the second block is failing an Oracle Prepare Error. &amp;nbsp;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1506      proc sql;
1507      create table QueryData as
1508      (       select DISTINCT %str(%')&amp;amp;analysis_desc.%str(%') as RULE_NM length = 1200,
1509              b.actual_dlvry_date as AD_DT,
1510              b.imb_code length = 100,
1511              &amp;amp;rule_order as RULE_ORDER,
1512              b.spm_calc_batch_date
1513              from iv_ora.bi_spm_piece_recon a,  bids_ora.bi_spm_piece_recon b
1514              where a.spm_calc_batch_date = b.spm_calc_batch_date
1515                and a.imb_code = b.imb_code
1516              and &amp;amp;rule
1517      );
1518      quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1550 proc sql;
1551 connect to oracle as db
1551! (user=&amp;amp;orauser password=&amp;amp;orapass path="ivasprd");
1552 create table QueryData as
1553 select * from connection to db
1554 ( select 'PIECES MISSING IN IV' as RULE_NM length = 1200,
1555 actual_dlvry_date as AD_DT,
1556 imb_code length = 100,
1557 999.1 as RULE_ORDER,
1558 spm_calc_batch_date
1559 from ivprl.bi_spm_piece_bids_recon
1560 where imb_code||trunc(spm_calc_batch_date) not in(select imb_code||trunc(spm_calc_batch_date) from
1560! ivprl.bi_spm_piece_iv_recon)
1561 );
ERROR: ORACLE prepare error: ORA-00923: FROM keyword not found where expected. SQL statement: select 'PIECES MISSING IN IV' as
RULE_NM length = 1200, actual_dlvry_date as AD_DT, imb_code length = 100, 999.1 as RULE_ORDER, spm_calc_batch_date from
ivprl.bi_spm_piece_bids_recon where imb_code||trunc(spm_calc_batch_date) not in(select
imb_code||trunc(spm_calc_batch_date) from ivprl.bi_spm_piece_iv_recon).
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
1562 disconnect from db;
NOTE: Statement not executed due to NOEXEC option.
1563 quit;
NOTE: The SAS System stopped processing this step because of errors.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 17:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268607#M53181</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-05T17:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268726#M53211</link>
      <description>&lt;P&gt;Try system options varlencheck=, But I don't think that is a good idea to ignore it .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS VARLENCHK=NOWARN ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 May 2016 02:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268726#M53211</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-05-06T02:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Variable RULE_NM has different lengths on BASE and DATA files (BASE 29 DATA 28).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268750#M53221</link>
      <description>&lt;P&gt;You are mixing up SAS and SQL. &amp;nbsp;SQL is a separate language implemented mainly for&amp;nbsp;databases. &amp;nbsp;SAS has the SQL engine and you can use it fine in SAS mixing in SAS. &amp;nbsp;However your second statement is sending the SQL to the database, via Pass-Through. &amp;nbsp;The SQL you pass through has to be valid SQL for the database your sending it to, and length isn't going to be valida there are SAS/Databases are different. &amp;nbsp;Get your data out of Oracle, in the first instance, elsewhere, and store it to a SAS dataset. &amp;nbsp;Then you can use either Base SAS or SAS's SQL implementation to process it.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 08:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Variable-RULE-NM-has-different-lengths-on-BASE-and-DATA/m-p/268750#M53221</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-06T08:12:10Z</dc:date>
    </item>
  </channel>
</rss>

