<?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: Why is this macro dont working? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395418#M95362</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason for the errors is because macro variables like cursoacademico&amp;nbsp;are not set.&amp;nbsp; There are two possibilities...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either your %LETs were wrong, so&amp;nbsp;where you had...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token macroname"&gt;&amp;nbsp;&amp;nbsp; %let&lt;/SPAN&gt; PERIODO_REF_ACT &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; cursoacademico&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;You should have had &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token macroname"&gt;&amp;nbsp;&amp;nbsp; %let&lt;/SPAN&gt;&amp;nbsp;cursoacademico = PERIODO_REF_ACT ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Or your input statement used the wrong macro variable name, so&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&amp;nbsp; @&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;cursoacademico &lt;SPAN class="token number"&gt;4&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;should have been &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&amp;nbsp; @&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;PERIODO_REF_ACT &lt;/SPAN&gt;&lt;SPAN class="token number"&gt;4&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Once you know which you really need&amp;nbsp;you can change all the others in the same way.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2017 08:01:08 GMT</pubDate>
    <dc:creator>MarkDawson</dc:creator>
    <dc:date>2017-09-13T08:01:08Z</dc:date>
    <item>
      <title>Why is this macro dont working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395413#M95357</link>
      <description>&lt;P&gt;What im trying to do is load some txt plain.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DIR_IN_BASE=I:\SGEE\SGEE\Jorge\Proyecto\ENTRADA; 
%let DIR_OUT_BASE=I:\SGEE\SGEE\Jorge\Proyecto\SALIDA;

%let RUT_IN=&amp;amp;DIR_IN_BASE;

%let FILE_TIT_IN=fp;
%let FILE_TIT_OUT=fichero_fp_salida;

%let CURSO=17;

**nombre variables;
%let PERIODO_REF_ACT = cursoacademico;
%let COD_TIPO_DOCU = tipodocumento;
%let ID_DOCUMENTO = documento;
%let COD_SEXO = sexo;
%let COD_GRUPO_EDAD = grupoedad;
%let COD_TIPO_ACT = curso;
%let COD_CENTRO = centro;
%let COD_SITUAC_SOCIO = situacionsocial;
%let COD_SITUAC_ACTIV = situacionlaboral;
%let FECHA_ENTR_ACT = entrada;
%let FECHA_SAL_ACT = salida;

libname fp_out "&amp;amp;DIR_OUT_BASE";

%macro mImport_txt(FILE_IN=,FILE_OUT=);
DATA &amp;amp;FILE_OUT; 
INFILE &amp;amp;FILE_IN pad lrecl=5000;
INPUT   
		@1 &amp;amp;cursoacademico 4.
		@5 &amp;amp;tipodocumento 1.
		@6 &amp;amp;documento $ 9.
		@15 &amp;amp;sexo 1.
		@16 &amp;amp;grupoedad 2.
		@18 &amp;amp;curso 3.
		@21 &amp;amp;centro 8.
		@29 &amp;amp;situacionsocial 1.
		@30 &amp;amp;situacionlaboral 1.
		@31 &amp;amp;entrada $ 8.
		@39 &amp;amp;salida $ 8.;
RUN;
%mend mImport_txt;

%mImport_txt(FILE_IN="&amp;amp;RUT_IN.&amp;amp;FILE_TIT_IN..txt",FILE_OUT=&amp;amp;FILE_TIT_IN._&amp;amp;CURSO);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the error is this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;15         %mImport_txt(FILE_IN="&amp;amp;RUT_IN.&amp;amp;FILE_TIT_IN..txt",FILE_OUT=&amp;amp;FILE_TIT_IN._&amp;amp;CURSO);
22: LINE y COLUMN no se pueden determinar.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN 
              where the error has occurred.
ERROR 22-322: Expecting a name.  
WARNING: Apparent symbolic reference CURSOACADEMICO not resolved.
22: LINE y COLUMN no se pueden determinar.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN 
              where the error has occurred.
ERROR 22-322: Expecting a name.  
WARNING: Apparent symbolic reference TIPODOCUMENTO not resolved.
22: LINE y COLUMN no se pueden determinar.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thanks for all!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 07:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395413#M95357</guid>
      <dc:creator>jbs23</dc:creator>
      <dc:date>2017-09-13T07:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this macro dont working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395415#M95359</link>
      <description>&lt;P&gt;When you do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let PERIODO_REF_ACT = cursoacademico;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you set the &lt;EM&gt;macro variable&lt;/EM&gt; &lt;FONT face="courier new,courier"&gt;PERIODO_REF_ACT&lt;/FONT&gt; to the &lt;EM&gt;value&lt;/EM&gt; &lt;FONT face="courier new,courier"&gt;cursoacademico&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;When you do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INPUT   
		@1 &amp;amp;cursoacademico 4.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you are trying to reference the &lt;EM&gt;macro variable&lt;/EM&gt; &lt;FONT face="courier new,courier"&gt;cursoacademico&lt;/FONT&gt;, which does not exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you want to use different variable (column) names, when the files have apparently the same structure?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 07:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395415#M95359</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-09-13T07:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this macro dont working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395418#M95362</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason for the errors is because macro variables like cursoacademico&amp;nbsp;are not set.&amp;nbsp; There are two possibilities...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either your %LETs were wrong, so&amp;nbsp;where you had...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token macroname"&gt;&amp;nbsp;&amp;nbsp; %let&lt;/SPAN&gt; PERIODO_REF_ACT &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; cursoacademico&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;You should have had &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token macroname"&gt;&amp;nbsp;&amp;nbsp; %let&lt;/SPAN&gt;&amp;nbsp;cursoacademico = PERIODO_REF_ACT ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Or your input statement used the wrong macro variable name, so&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&amp;nbsp; @&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;cursoacademico &lt;SPAN class="token number"&gt;4&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;should have been &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp;&amp;nbsp; @&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;PERIODO_REF_ACT &lt;/SPAN&gt;&lt;SPAN class="token number"&gt;4&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Once you know which you really need&amp;nbsp;you can change all the others in the same way.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 08:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395418#M95362</guid>
      <dc:creator>MarkDawson</dc:creator>
      <dc:date>2017-09-13T08:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this macro dont working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395421#M95365</link>
      <description>&lt;P&gt;Why do you have all the macro code? &amp;nbsp;As I mention in your other post. &amp;nbsp;To import a file you do a simple:&lt;/P&gt;
&lt;PRE&gt;data want;
  infile...;
  informat...;
  format...;
  length...;
  input...;
run;&lt;/PRE&gt;
&lt;P&gt;You will see from the above there is no % this or &amp;amp; that, just plain simple Base SAS code. &amp;nbsp;This is the place to start (and in 99% of cases stop). &amp;nbsp;Do not get into the habbit of using macro just for the sake of using, it does not add anything to the code and makes it far less reliable and harder to maintain, especially when you consider the code presented has no need for the macro whatsoever.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 08:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395421#M95365</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-13T08:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this macro dont working?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395424#M95368</link>
      <description>&lt;P&gt;I think it's because of this&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; DIR_IN_BASE&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;I:&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;SGEE&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;SGEE&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;Jorge&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;Proyecto&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;ENTRADA&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;change it to this&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; DIR_IN_BASE&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;I:&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;SGEE&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;SGEE&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;Jorge&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;Proyecto&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;ENTRADA\&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 08:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-is-this-macro-dont-working/m-p/395424#M95368</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-13T08:31:13Z</dc:date>
    </item>
  </channel>
</rss>

