<?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: How to resolve Macro variable in infile statement. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573343#M161854</link>
    <description>&lt;P&gt;Sry it is not &amp;amp;terr it is &amp;amp;X&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; X &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"AU"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"US"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"IND"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 

&lt;SPAN class="token procnames"&gt;Data&lt;/SPAN&gt; one&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;X&lt;/SPAN&gt; dlm &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;","&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; A &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 14 Jul 2019 06:26:44 GMT</pubDate>
    <dc:creator>Swati24</dc:creator>
    <dc:date>2019-07-14T06:26:44Z</dc:date>
    <item>
      <title>How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573275#M161816</link>
      <description>&lt;P&gt;I have a macro variable with few values i want to use this variable to create a data set having these values with the help of infile statement. I have tried but I'm getting some error. Please help me out in this and thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let X = "AU","US","IND";&lt;/P&gt;&lt;P&gt;Data one;&lt;BR /&gt;infile &amp;amp;terr dlm = ",";&lt;BR /&gt;input A $ @@;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jul 2019 08:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573275#M161816</guid>
      <dc:creator>Swati24</dc:creator>
      <dc:date>2019-07-13T08:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573279#M161820</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X = "AU","US","IND"; /* what for is X defined? It's never used */

Data one;
infile &amp;amp;terr dlm = ","; /* where and how is terr defined? */
input A $ @@;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please supply:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the log of your code; use the {i} button for this&lt;/LI&gt;
&lt;LI&gt;the statement(s) where &amp;amp;terr is defined&lt;/LI&gt;
&lt;LI&gt;an example of your input file&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 13 Jul 2019 10:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573279#M161820</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-13T10:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573280#M161821</link>
      <description>&lt;P&gt;Are you trying to get this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let X = "AU, US, IND";

Data one;
nw = countw(&amp;amp;X);
do i = 1 to nw;
   A = scan(&amp;amp;X,i);
   output;
end;
keep A;
run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Jul 2019 10:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573280#M161821</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-07-13T10:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573294#M161829</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236019"&gt;@Swati24&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a macro variable with few values i want to use this variable to create a data set having these values with the help of infile statement. I have tried but I'm getting some error. Please help me out in this and thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let X = "AU","US","IND";&lt;/P&gt;
&lt;P&gt;Data one;&lt;BR /&gt;infile &amp;amp;terr dlm = ",";&lt;BR /&gt;input A $ @@;&lt;BR /&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Look at PROC STREAM.&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n1sak3n3asxfbqn1aw24lxdvez69.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n1sak3n3asxfbqn1aw24lxdvez69.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Or use the "_infile_" trick.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let X = "AU","US","IND";

data one;
  infile cards dsd ;
  input @;
  _infile_ =symget('x');
  length A $8 ;
  do until(a=' ');
      input A $ @ ;
      if not missing(a) then output;
  end;
cards;
-- this line is ignored --
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Jul 2019 14:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573294#M161829</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-13T14:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573306#M161833</link>
      <description>Why do you have a macro variable X, but then the macro variable &amp;amp;TERR in the INFILE statement. Where is TERR defined?</description>
      <pubDate>Sat, 13 Jul 2019 18:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573306#M161833</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-13T18:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573343#M161854</link>
      <description>&lt;P&gt;Sry it is not &amp;amp;terr it is &amp;amp;X&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; X &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"AU"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"US"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"IND"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 

&lt;SPAN class="token procnames"&gt;Data&lt;/SPAN&gt; one&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;X&lt;/SPAN&gt; dlm &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;","&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; A &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Jul 2019 06:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573343#M161854</guid>
      <dc:creator>Swati24</dc:creator>
      <dc:date>2019-07-14T06:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573345#M161855</link>
      <description>&lt;P&gt;After cards; nothing will be written&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 06:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573345#M161855</guid>
      <dc:creator>Swati24</dc:creator>
      <dc:date>2019-07-14T06:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573346#M161856</link>
      <description>&lt;P&gt;Replace &amp;amp;X with the contents of X, and you will see that it creates invalid code (consult the documentation of the infile statement).&lt;/P&gt;
&lt;P&gt;If that are the names of three different infiles, you can concatenate the files by using brackets around the filenames.&lt;/P&gt;
&lt;P&gt;But I strongly believe that "AU" (for instance) is not the name of an external (text) file in your current working directory.&lt;/P&gt;
&lt;P&gt;Please describe in more detail what you want to do.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 06:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573346#M161856</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-14T06:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573347#M161857</link>
      <description>&lt;P&gt;run should be there or not&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 06:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573347#M161857</guid>
      <dc:creator>Swati24</dc:creator>
      <dc:date>2019-07-14T06:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573348#M161858</link>
      <description>&lt;P&gt;As it is throwing data error Saying&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE: LOST CARD.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;84 OPTIONS NONOTES 15&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;A=IND _ERROR_=1 _INFILE_= _N_=1&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.ONE has 3 observations and 1 variables.&lt;/DIV&gt;</description>
      <pubDate>Sun, 14 Jul 2019 06:41:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573348#M161858</guid>
      <dc:creator>Swati24</dc:creator>
      <dc:date>2019-07-14T06:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573350#M161859</link>
      <description>&lt;P&gt;Quote from myself:&lt;/P&gt;
&lt;P&gt;"&lt;STRONG&gt;&lt;SPAN&gt;Please describe in more detail what you want to do.&lt;/SPAN&gt;&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;Little bits and pieces like this&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236019"&gt;@Swati24&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;As it is throwing data error Saying&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasNote"&gt;NOTE: LOST CARD.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;84 OPTIONS NONOTES 15&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;A=IND _ERROR_=1 _INFILE_= _N_=1&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.ONE has 3 observations and 1 variables.&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;are not helpful.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 08:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573350#M161859</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-14T08:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573361#M161865</link>
      <description>&lt;PRE&gt;%let X = "AU","US","IND";

data want;
 do i=1 to countw(symget('x'),',"');
  x=scan(symget('x'),i,',"');
  output;
 end;
run;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Jul 2019 11:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573361#M161865</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-14T11:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Macro variable in infile statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573372#M161872</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236019"&gt;@Swati24&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;run should be there or not&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You include a RUN or QUIT statement to let SAS (and other programmers) know that you have reached the end of a procedure or data step.&amp;nbsp; But a data step that includes in-line data (signaled by the CARDS statement or as it has been renamed DATALINES) ends when the in-line data ends.&amp;nbsp; Any extra RUN statement after that will not have any effect other than confusing some novice programmers into thinking they can insert additional data step statements between the lines of data and the run statement.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 14:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-Macro-variable-in-infile-statement/m-p/573372#M161872</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-14T14:33:44Z</dc:date>
    </item>
  </channel>
</rss>

