<?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 bring 3 lines into one line in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874772#M42900</link>
    <description>&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;It is a json file like a text file, and I would like to bring each row in one variable ex :&lt;BR /&gt;var1 into a sas dataset&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We still need to see the equivalent SAS data set. We are asking you to provide (a portion of) the SAS data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your question that you don't know how to get it into SAS?&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2023 21:18:00 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-05-09T21:18:00Z</dc:date>
    <item>
      <title>how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874759#M42894</link>
      <description>&lt;P&gt;how to bring 3 lines like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{ "firstName" :"Clint1", "lastName" :"Eastwood1", "email" :"Clint1.Eastwood1@hotmail.com", "extRef" :"235987",&lt;BR /&gt;"embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"15JUL2020:14:29:52",&lt;BR /&gt;"Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" },&lt;BR /&gt;{ "firstName" :"Clint2", "lastName" :"Eastwood2", "email" :"Clint2.Eastwood2@hotmail.com", "extRef" :"236663",&lt;BR /&gt;"embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"29AUG2022:08:25:57",&lt;BR /&gt;"Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" },&lt;BR /&gt;{ "firstName" :"Clint3", "lastName" :"Eastwood3", "email" :"Clint3.Eastwood3@hotmail.com", "extRef" :"236900",&lt;BR /&gt;"embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"29JUL2020:16:21:59",&lt;BR /&gt;"Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" },&lt;BR /&gt;{ "firstName" :"Clint4", "lastName" :"Eastwood4", "email" :"Clint4.Eastwood4@hotmail.com", "extRef" :"237009",&lt;BR /&gt;"embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"07NOV2019:04:24:10",&lt;BR /&gt;"Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" },&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like that :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{ "firstName" :"Clint1", "lastName" :"Eastwood1", "email" :"Clint1.Eastwood1@hotmail.com", "extRef" :"235987","embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"15JUL2020:14:29:52","Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }&lt;BR /&gt;{ "firstName" :"Clint2", "lastName" :"Eastwood2", "email" :"Clint2.Eastwood2@hotmail.com", "extRef" :"236663","embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"29AUG2022:08:25:57","Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }&lt;BR /&gt;{ "firstName" :"Clint3", "lastName" :"Eastwood3", "email" :"Clint3.Eastwood3@hotmail.com", "extRef" :"236900", "embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"29JUL2020:16:21:59", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }&lt;BR /&gt;{ "firstName" :"Clint4", "lastName" :"Eastwood4", "email" :"Clint4.Eastwood4@hotmail.com", "extRef" :"237009","embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"07NOV2019:04:24:10","Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 21:01:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874759#M42894</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-05-09T21:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874764#M42895</link>
      <description>&lt;P&gt;Is this a SAS question? It doesn't seem as if you are working with SAS data sets here.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 21:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874764#M42895</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-09T21:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874766#M42896</link>
      <description>It is a json file like a text file, and I would like to bring each row in one variable ex :&lt;BR /&gt;var1 into a sas dataset&lt;BR /&gt;</description>
      <pubDate>Tue, 09 May 2023 21:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874766#M42896</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-05-09T21:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874767#M42897</link>
      <description>Like I mnetioned in your previous post it's a badly formed JSON file. How was it created? Ideally you fix it at source instead. &lt;BR /&gt;&lt;BR /&gt;PROC JSON won't read the file directly unfortunately so otherwise you're parsing manually. Are the line returns in your dataset hard coded, or those just how it's viewed?</description>
      <pubDate>Tue, 09 May 2023 21:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874767#M42897</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-09T21:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874768#M42898</link>
      <description>yes, there is carriage return line feed</description>
      <pubDate>Tue, 09 May 2023 21:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874768#M42898</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-05-09T21:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874770#M42899</link>
      <description>&lt;P&gt;the idea is to bring each record into a sas dataset under the variable jsoninfo.&amp;nbsp; Then do a call execute on each record as you have proposed to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 21:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874770#M42899</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-05-09T21:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874772#M42900</link>
      <description>&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;It is a json file like a text file, and I would like to bring each row in one variable ex :&lt;BR /&gt;var1 into a sas dataset&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We still need to see the equivalent SAS data set. We are asking you to provide (a portion of) the SAS data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your question that you don't know how to get it into SAS?&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 21:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874772#M42900</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-09T21:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874790#M42901</link>
      <description>&lt;P&gt;I wouldn't bother reading it into a data set, you'll have to add back the JSON formatting later on anyways.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, just delete the extra comma at the end of each series of information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile '/home/fkhurshed/CLASS2/example1.json';
length value $500.;
if mod(_n_, 3)=1 then record+1;
input;
value = _infile_;
run;

data clean;
set have;
by record;
if last.record then value = substr(value, 1, length(value)-1);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then write to each new JSON file dynamically.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm#n0m1x5yncfgf4yn16d6ui4h6uinn" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm#n0m1x5yncfgf4yn16d6ui4h6uinn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And instead of looping your old macro. Call it using CALL Execute after you write the last line of the output.&lt;/P&gt;
&lt;P&gt;Probably needs some debugging - but I have to go take kiddo to swim class &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro upload_contact(row= , filename=);
					filename respp&amp;amp;row. "%sysfunc(getoption(WORK))/Consentinfo&amp;amp;row..json";

filename dest&amp;amp;row "path to JSON file created in data step";
					PROC HTTP
						METHOD="POST"
    					URL= "&amp;amp;url_./directories/&amp;amp;&amp;amp;DirectoryId&amp;amp;j./contacts"
    					OUT=respp&amp;amp;row.
    					in=dest&amp;amp;j.;
    					headers
   						'x-api-token'= &amp;amp;Api_Token.
   						'Content-Type'='application/json';   
					run;
					
					libname respp&amp;amp;row. json "%sysfunc(getoption(WORK))/Consentinfo&amp;amp;row..json";
					proc datasets lib=respp&amp;amp;row.;
					run;

					data TrasactionContactsImportSummary&amp;amp;row.;
					set respp&amp;amp;row..alldata;
					run;

					data result&amp;amp;row.;
					set respp&amp;amp;row..result;
					call symputx("ContactId&amp;amp;row.",id,'g');
					run;
				%mend;	


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 22:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874790#M42901</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-09T22:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874803#M42902</link>
      <description>&lt;P&gt;I cannot tell the difference between the two things.&amp;nbsp; It does not help that you typed them into the body of your message instead of into a text box created by the Insert Code or Insert SAS Code editor icons.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 00:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874803#M42902</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-10T00:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to bring 3 lines into one line</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874804#M42903</link>
      <description>&lt;P&gt;If you know that you want to convert three lines into one then just do that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile json truncover ;
  input line1 $200. / line2 $200. / line3 $200. ;
  file jsonl ;
  substr(line3,length(line3))=' ';
  put line1 line2 line3 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;{ "firstName" :"Clint1", "lastName" :"Eastwood1", "email" :"Clint1.Eastwood1@hotmail.com", "extRef" :"235987", "embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"15JUL2020:14:29:52", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }
{ "firstName" :"Clint2", "lastName" :"Eastwood2", "email" :"Clint2.Eastwood2@hotmail.com", "extRef" :"236663", "embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"29AUG2022:08:25:57", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }
{ "firstName" :"Clint3", "lastName" :"Eastwood3", "email" :"Clint3.Eastwood3@hotmail.com", "extRef" :"236900", "embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"29JUL2020:16:21:59", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }
{ "firstName" :"Clint4", "lastName" :"Eastwood4", "email" :"Clint4.Eastwood4@hotmail.com", "extRef" :"237009", "embeddedData" : { "Brand" :"Anthony Insurance", "Consent Date" :"07NOV2019:04:24:10", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }&lt;/PRE&gt;
&lt;P&gt;Or is your actual input file more complicated that three lines per "observation"?&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 00:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-bring-3-lines-into-one-line/m-p/874804#M42903</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-10T00:15:56Z</dc:date>
    </item>
  </channel>
</rss>

