<?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: Issue with importing text parameter file using input statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854212#M337586</link>
    <description>&lt;P&gt;This parameter file defines global macro variables and their values. Such that&amp;nbsp;log_transform is a macro variable with value 'N'.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 22:06:41 GMT</pubDate>
    <dc:creator>lydiawawa</dc:creator>
    <dc:date>2023-01-17T22:06:41Z</dc:date>
    <item>
      <title>Issue with importing text parameter file using input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854208#M337584</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm importing a parameter file in txt form with no title row such as the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;byvars             TEST16X GIO
log_transform      N
y_intercept        Y
exclude_outliers   N
exclude_einmos     N&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Because it is a parameter file, the length of the two columns will not be fixed. The following is the problematic code I created to import the txt file. The two columns are concatenated instead of splitting into individual columns:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test1;
	infile "files/parameters.txt" DELIMITER='09'x col=Colpoint
	length=linelen;
	length pname $30 pvalue $10;

	input @1 pname $ @;
	varlen=linelen - colpoint + 1;
    input pvalue $varying1024. varlen;
	call symputx('pname', STRIP(pvalue));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lydiawawa_0-1673991736794.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79462iE36570273482EE7A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lydiawawa_0-1673991736794.png" alt="lydiawawa_0-1673991736794.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 21:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854208#M337584</guid>
      <dc:creator>lydiawawa</dc:creator>
      <dc:date>2023-01-17T21:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with importing text parameter file using input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854211#M337585</link>
      <description>&lt;P&gt;The data you posted uses spaces as delimiters, not tabs.&amp;nbsp; The program to read it could be as simple as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   infile "files/parameters.txt";
   length pname $ 30 pvalue $ 10;
   input pname pvalue;
   call symputx(pname, pvalue);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It's not clear why you want macro variables here, and if you don't need them you could remove the last statement.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 21:59:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854211#M337585</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-01-17T21:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with importing text parameter file using input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854212#M337586</link>
      <description>&lt;P&gt;This parameter file defines global macro variables and their values. Such that&amp;nbsp;log_transform is a macro variable with value 'N'.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 22:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854212#M337586</guid>
      <dc:creator>lydiawawa</dc:creator>
      <dc:date>2023-01-17T22:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with importing text parameter file using input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854213#M337587</link>
      <description>&lt;P&gt;Do you have specifications for how the file was created?&lt;/P&gt;
&lt;P&gt;Is the white space between the two values spaces or a single tab character?&amp;nbsp; Your program is saying it should be a single TAB character, but the text you posted has spaces instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is a tab character then using DSD should work, as long as any PVALUE that has a tab in it is quoted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data parameters;
  infile "files/parameters.txt" dsd dlm='09'x truncover ;
  input pname :$32. pvalue :$200.;
  call symputx(pname,pvalue);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the delimiter is a space (or the PVALUE has embedded delimiters without quotes) and parameter name does not contain any spaces then you can just use formatted input for the PVALUE. Using formatted input will read through and delimiters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data parameters;
  infile "files/parameters.txt" truncover ;
  input pname :$32. pvalue $200.;
  call symputx(pname,pvalue);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 22:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-importing-text-parameter-file-using-input-statement/m-p/854213#M337587</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-17T22:06:44Z</dc:date>
    </item>
  </channel>
</rss>

