<?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 append two text files in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861889#M42424</link>
    <description>&lt;P&gt;I don't see two text files here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have an existing text file and you want copy another text file to the end of it a simple data step should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'any other file name';
  file 'some file name' mod;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a dataset and you want to append the data in it to an existing file then you just need a data step.&lt;/P&gt;
&lt;P&gt;If the dataset is named JSON_DATA and it has a variable named JSON_TEXT that you want to write then the code would look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set json_data;
  file 'some file name' mod;
  put json_text ;
run;  &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 Mar 2023 04:16:37 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-03-02T04:16:37Z</dc:date>
    <item>
      <title>how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861847#M42413</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am reading an Oracle table which contains a json file.&amp;nbsp; Then I would like to create another json file using datalines (see code). Thereafter append both to get the wanted file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have issue with json_in_4.json.&lt;/P&gt;
&lt;P&gt;First, if there is a space in the datalines information, it reads only the first term instead of reading the full line.&lt;/P&gt;
&lt;P&gt;I would like to convert/replace the value of batchid by is value and that into the datalines statements.&lt;/P&gt;
&lt;P&gt;and to always replace the content of&amp;nbsp;json_in_4.json.&lt;/P&gt;
&lt;PRE&gt;data Info_1;
length info $4000 ;
set bi.**********jsonformat_TMP (rename=(JSON_FORMAT=Info));
run;

filename x1 "&amp;amp;path./output/json_in_3.json";
data _null_;
     set Info_1;
     file x LRECL=300;
put Info;
run;

%let batchid=AAAAAAAAAAAAA2023;
filename x2 "&amp;amp;path./output/json_in_4.json" mod;
data _null_;
	file x2 ;
  	input Info: $200. ;
  	put Info;
datalines;
{"transactionMeta":  {"batchId":"&amp;amp;batchid.","fields":["QueueName"]},"contacts":[
;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 20:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861847#M42413</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-01T20:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861849#M42415</link>
      <description>&lt;P&gt;I have found how to put the macro variable value into the datalines statements.&lt;/P&gt;
&lt;P&gt;see the sas code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let batchid=AAAAAAAAAAAAA2023;
filename x2 "&amp;amp;path./output/json_in_4.json" mod;
data _null_;
	file x2 ;
  	input Info: $200. ;
    textresolved=dequote(resolve(quote(Info)));
	put textresolved;
datalines;
{"transactionMeta":{"batchId":"&amp;amp;batchid.","fields":["QueueName"]},"contacts":[
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The contents of&amp;nbsp;&lt;CODE class=" language-sas"&gt;json_in_4.json is&amp;nbsp;now:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;{"transactionMeta":{"batchId":"AAAAAAAAAAAAA2023","fields":["QueueName"]},"contacts":[&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 20:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861849#M42415</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-01T20:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861851#M42416</link>
      <description>&lt;P&gt;Alternatively you could also look at the macro variable name as a token that you replace using tranwrd()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let batchid=AAAAAAAAAAAAA2023;
/*filename x2 "&amp;amp;path./output/json_in_4.json" mod;*/
data _null_;
/*	file x2 ;*/
  file print;
  input Info: $200. ;
  length textresolved txtresolved2 $200;
  textresolved=dequote(resolve(quote(Info)));
  txtresolved2=tranwrd(info,'&amp;amp;batchid.',"&amp;amp;batchid");
	put textresolved=;
	put txtresolved2=;
datalines;
{"transactionMeta":{"batchId":"&amp;amp;batchid.","fields":["QueueName"]},"contacts":[
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1677705948168.png" style="width: 812px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81002iCDBF8BEE343A47C9/image-dimensions/812x68?v=v2" width="812" height="68" role="button" title="Patrick_0-1677705948168.png" alt="Patrick_0-1677705948168.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 21:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861851#M42416</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-01T21:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861854#M42417</link>
      <description>&lt;P&gt;I am still not able to read the json file as a text file.&lt;/P&gt;
&lt;P&gt;NOTE: 0 records were read from the infile IN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in ("&amp;amp;path./output/json_in_4.json","&amp;amp;path./output/json_in_3.json");
data all ;
infile in dsd truncover;
length line $4000 ;
line=_infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2023 21:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861854#M42417</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-01T21:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861858#M42419</link>
      <description>&lt;P&gt;Can you share your json file (attach to the discussion) so we have something to test with. ...or some mock-up that's good enough for testing will do as well.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 21:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861858#M42419</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-01T21:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861866#M42420</link>
      <description>&lt;P&gt;we can test by appending twice the file json_in_4.json&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The contents of&amp;nbsp;&lt;CODE class="  language-sas"&gt;json_in_4&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;json is now:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"transactionMeta"&lt;/SPAN&gt;:&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"batchId"&lt;/SPAN&gt;:&lt;SPAN class="token string"&gt;"AAAAAAAAAAAAA2023"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"fields"&lt;/SPAN&gt;:&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"QueueName"&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 string"&gt;"contacts"&lt;/SPAN&gt;:&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 23:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861866#M42420</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-01T23:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861875#M42421</link>
      <description>&lt;P&gt;A json is just a text file. What's not working? Please share the actual code and SAS log. Or share a mock-up json as attachment representative for your real file.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 00:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861875#M42421</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-02T00:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861885#M42422</link>
      <description>&lt;P&gt;That what I though.&amp;nbsp; A json file is just like a text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let batchid=AAAAAAAAAAAAA2023;
filename x2 "&amp;amp;path./output/json_in_4.json" mod;
data _null_;
	file x2 ;
  	input Info: $200. ;
    textresolved=dequote(resolve(quote(Info)));
	put textresolved;
datalines;
{"transactionMeta":{"batchId":"&amp;amp;batchid.","fields":["QueueName"]},"contacts":[
;
run;

options mprint mlogic symbolgen;
filename in ("&amp;amp;path./output/json_in_4.json");
data all ;
  infile in lrecl=4000;
  length line $4000 ;
  line=_infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NOTE: The file X2 is:&lt;BR /&gt;Filename=/.....json_in_4.json,&lt;BR /&gt;Owner Name=*****, Group Name=*****,&lt;BR /&gt;Access Permission=-rwxrwxrwx,&lt;BR /&gt;Last Modified=01 mars 2023 22 h 25,&lt;BR /&gt;File Size (bytes)=174&lt;/P&gt;
&lt;P&gt;SYMBOLGEN: Macro variable BATCHID resolves to AAAAAAAAAAAAA2023&lt;BR /&gt;NOTE: 1 record was written to the file X2.&lt;BR /&gt;The minimum record length was 86.&lt;BR /&gt;The maximum record length was 86.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*********************************&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data all ;&lt;BR /&gt;44 infile in lrecl=4000;&lt;BR /&gt;45 length line $4000 ;&lt;BR /&gt;46 line=_infile_;&lt;BR /&gt;47 run;&lt;/P&gt;
&lt;P&gt;NOTE: The infile IN is:&lt;BR /&gt;Filename=/.../json_in_4.json,&lt;BR /&gt;Owner Name=********,Group Name=*********,&lt;BR /&gt;Access Permission=-rwxrwxrwx,&lt;BR /&gt;Last Modified=01 mars 2023 22 h 28,&lt;BR /&gt;3 The SAS System 22:25 Wednesday, March 1, 2023&lt;/P&gt;
&lt;P&gt;File Size (bytes)=261&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: 0 records were read from the infile IN.&lt;/STRONG&gt;&lt;BR /&gt;NOTE: The data set WORK.ALL has 1 observations and 1 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.ALL increased size by 100.00 percent. &lt;BR /&gt;Compressed is 2 pages; un-compressed would require 1 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;It is like SAS EG is not able to read the json file&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 03:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861885#M42422</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-02T03:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861887#M42423</link>
      <description>&lt;P&gt;There is no INPUT statement in your code.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 04:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861887#M42423</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-02T04:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861889#M42424</link>
      <description>&lt;P&gt;I don't see two text files here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have an existing text file and you want copy another text file to the end of it a simple data step should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'any other file name';
  file 'some file name' mod;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a dataset and you want to append the data in it to an existing file then you just need a data step.&lt;/P&gt;
&lt;P&gt;If the dataset is named JSON_DATA and it has a variable named JSON_TEXT that you want to write then the code would look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set json_data;
  file 'some file name' mod;
  put json_text ;
run;  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2023 04:16:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861889#M42424</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-02T04:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861908#M42426</link>
      <description>&lt;P&gt;Without an INPUT statement, nothing is read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am still not able to read the json file as a text file.&lt;/P&gt;
&lt;P&gt;NOTE: 0 records were read from the infile IN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in ("&amp;amp;path./output/json_in_4.json","&amp;amp;path./output/json_in_3.json");
data all ;
infile in dsd truncover;
length line $4000 ;
line=_infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 08:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861908#M42426</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-02T08:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861955#M42438</link>
      <description>&lt;P&gt;After reading all the remarks, I feel that I need to start over and explain what I would like to do and provide test datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the first step is to connect to an oracle db and read a table which is like a json file (ref: json_2.txt).&lt;/P&gt;
&lt;P&gt;Then this file is put into a dataset to see what SAS is reading.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Info_1;
length info $5000 ;
set oracle.?????????????_TMP (rename=(JSON_FORMAT=Info));
run;

the libname and part of the filename have bee replaced for safety purpose.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then this sas dataset is send into a json file (json_in_2.json).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
     set Info_1;
     file dest1 LRECL=5000;
put Info;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not familiar with json file at all but when I look at the obtained result, some records are consecutive and other have a carriage return linefeed between.&amp;nbsp; I suppose that we should have a crlf between each records.&amp;nbsp; But maybe I am wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next step is to incorporate the value of the batchid into the datalines statements using the following code (ref:&amp;nbsp;json_1.txt).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let batchid=AAAAAAAAAAAAA2023;
filename x2 "&amp;amp;path./output/json_in_1.json" mod;
data _null_;
	file x2 ;
  	input Info: $200. ;
    textresolved=dequote(resolve(quote(Info)));
	put textresolved;
datalines;
{"transactionMeta":{"batchId":"&amp;amp;batchid.","fields":["QueueName"]},"contacts":[
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The script works fine but if I add a blank any where into the datalines statement, I will get a partial record.&amp;nbsp; Is there a way to solve that issue?&amp;nbsp; (Please feel free to correct that script if you dont like it)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then the final goal is two find a nice way to append json_1.txt and json_2.txt to obtain a result similar to this file(ref :&amp;nbsp;json_3.txt).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename source ("&amp;amp;path./output/json_in_1.json","&amp;amp;path./output/json_in_2.json");
data all ;
  infile source  LRECL=4000 ENCODING="LATIN1" TERMSTR=CRLF DLM='7F'x MISSOVER DSD ;
  length line $4000 ;
  INPUT line : $CHAR4000. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have used the sas import tool to see the kind of sas code generated and I have adapted it.&lt;/P&gt;
&lt;P&gt;But again, fell free to change it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that I have change the filename extension to permit to use the sas import tool.&lt;/P&gt;
&lt;P&gt;Also, the length of the real file will be pretty the same as for the test file.&amp;nbsp; I have increase the length to avoid warning and risk of truncanation but the first one is about 90 characters long while the second one is about 900 characters long.&lt;/P&gt;
&lt;P&gt;Could it be possible to explain me why I need LRRECL=4000 ?&amp;nbsp; How can we find the good value ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename source ("&amp;amp;path./output/json_in_1.json","&amp;amp;path./output/json_in_2.json");
data all ;
  infile source  LRECL=4000 ENCODING="LATIN1" TERMSTR=CRLF DLM='7F'x MISSOVER DSD ;
  length line $4000 ;
  INPUT line : $CHAR4000. ;
run;&lt;/CODE&gt;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 14:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861955#M42438</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-02T14:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861958#M42439</link>
      <description>I have replace the data Info_1;&lt;BR /&gt;length info $5000 ;&lt;BR /&gt;set oracle.?????????????_TMP (rename=(JSON_FORMAT=Info));&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;for &lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;Create table Info_1 as&lt;BR /&gt;select JSON_FORMAT as Info&lt;BR /&gt;FROM bisasbo.qualtrix_34_jsonformat_TMP;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;and everything works fine!&lt;BR /&gt;&lt;BR /&gt;Thanks all of you for your help&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Mar 2023 15:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861958#M42439</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-03-02T15:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to append two text files</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861967#M42442</link>
      <description>&lt;P&gt;Two things stand out to me in this that really do not make any sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First: Why are you using DATALINES to write a text file?&amp;nbsp; Why not just use PUT directly? Is your real problem more complex?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let batchid=AAAAAAAAAAAAA2023;
filename x2 "&amp;amp;path./output/json_in_1.json" mod;
data _null_;
  file x2 ;
  put "{""transactionMeta"":{""batchId"":""&amp;amp;batchid."",""fields"":[""QueueName""]},""contacts"":[" 
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also tat looks like the BEGINNING of JSON and not something to add at the END of an existing JSON file.&amp;nbsp; Where is the closing ] and closing }?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second: Why are you at the end trying to read the JSON file as text?&lt;/P&gt;
&lt;P&gt;If you wanted to do that why not just use the original dataset that already had the text in a variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 15:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-append-two-text-files/m-p/861967#M42442</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-02T15:41:32Z</dc:date>
    </item>
  </channel>
</rss>

