<?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 Splitting a very long and delimited string character variable into Multiple Columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739628#M230877</link>
    <description>&lt;P&gt;&lt;FONT size="2"&gt;Hello SAS Community,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I have a dataset (let's call it 'HAVE') with a single character variable called "line". This variable is very long and is delimited by '|'. Below are the first 3 rows of this dataset:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;lt;row 1&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;lt;row 2&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADLB|Lab analysis SI units &amp;amp; perf lab limits||AD0225|Calculation issue: PCHG != (AVAL - BASE)/BASE * 100|Error|16|1|351|5111|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;lt;row 3&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADSL|Subject-Level Analysis|ITTFL|TS0026|Analysis Preferable variable %Variable% not found|Warning|16|1|1|16|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I tried using the solution provided by&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410" target="_blank" rel="noopener"&gt;data_null__&lt;/A&gt;&lt;SPAN&gt;JADE&amp;nbsp; in this &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Splitting-string-variable-into-Multiple-Column/m-p/256539" target="_self"&gt;post&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;to break this record into multiple columns. However, when I use _infile_=line, _infile_ gets truncated.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Here is the program used to read "HAVE"&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;input line $305.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADLB|Lab analysis SI units &amp;amp; perf lab limits||AD0225|Calculation issue: PCHG != (AVAL - BASE)/BASE * 100|Error|16|1|351|5111|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADSL|Subject-Level Analysis|ITTFL|TS0026|Analysis Preferable variable %Variable% not found|Warning|16|1|1|16|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;proc print;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Here is my code, trying to break each record into 41 different columns following the &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Splitting-string-variable-into-Multiple-Column/m-p/256539" target="_self"&gt;solution provided&lt;/A&gt; by data_null__jade.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can copy and paste my code, if you want to replicate the (lack of) results and the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data want;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;infile cards dsd dlm='|' ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;if _n_ eq 1 then input @@;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;set have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;_infile_ = line;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;put _infile_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;input @1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;job_id&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;validated_gmt:anydtdtm21.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter:$CHAR40.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter_email:$CHAR45.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;project_id&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study_id&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package_id project:$CHAR23.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study:$CHAR35.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;protocol:$CHAR23.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package:$CHAR47.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;standard:$CHAR13.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;meddra&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;snomed:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;whodrug:$CHAR13.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;loinc&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;unii:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;ndf_rt:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;sdtm_ct:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;adam_ct:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;send_ct:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;dataset:$CHAR46.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;label:$CHAR106.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;variable:$CHAR10.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;rule:$CHAR7.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;message:$CHAR216.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;severity:$CHAR7.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;subjects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;failures&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;datapoints&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;records&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;define_included:$CHAR.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_compliance&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_ct&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_regulatory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_metadata&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_quality&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_analysis&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1:$CHAR200.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1_dt:anydtdtm21.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;@@&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;format &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;job_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;validated_gmt datetime. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter $40. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter_email $45. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;project_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;project $23. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study $35. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;protocol $23. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package $47. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;standard $13. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;meddra best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;snomed date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;whodrug $13. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;loinc best4. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;unii date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;ndf_rt date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;sdtm_ct date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;adam_ct date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;send_ct date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;dataset $46. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;label $106. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;variable $10. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;rule $7. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;message $216. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;severity $7. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;subjects best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;failures best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;datapoints best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;records best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;define_included $3. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_compliance best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_ct best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_regulatory best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_metadata best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_quality best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_analysis best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1 $200. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1_dt datetime.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Necessary evil&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;And here is the log. Notice that the first 7 variables get populated as desired. But starting from the 8th variable, all get null /missing values. Notice the results from the &lt;FONT face="courier new,courier"&gt;put _input_;&lt;/FONT&gt; statement:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#000000"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: LOST CARD.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;121 run;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;FONT face="courier new,courier"&gt;line=3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;0|100|56|| &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;job_id=3142 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;validated_gmt=09JUL18:03:24:00 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;submitter=xxxxxx xxxxx - Network &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;submitter_email=xxxx_xxx@work.com&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;project_id=41 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;study_id=266 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;data_package_id=337 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;project=i6a-je &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;study= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;protocol= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;data_package= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;standard= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;meddra=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;snomed=.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;whodrug= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;loinc=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;unii=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;ndf_rt=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;sdtm_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;adam_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;send_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;dataset= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;label= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;variable= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;rule= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;message= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;severity= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;subjects=.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;failures=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;datapoints=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;records=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;define_included= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_compliance=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_regulatory=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_metadata=.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_quality=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_analysis=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;active_explanation_1= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;active_explanation_1_dt=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;_ERROR_=1 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;_INFILE_= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;_N_=1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: There were 1 observations read from the data set WORK.HAVE.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: The data set WORK.WANT has 0 observations and 42 variables.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 May 2021 19:43:51 GMT</pubDate>
    <dc:creator>ruysolo</dc:creator>
    <dc:date>2021-05-06T19:43:51Z</dc:date>
    <item>
      <title>Splitting a very long and delimited string character variable into Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739628#M230877</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Hello SAS Community,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I have a dataset (let's call it 'HAVE') with a single character variable called "line". This variable is very long and is delimited by '|'. Below are the first 3 rows of this dataset:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;lt;row 1&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;lt;row 2&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADLB|Lab analysis SI units &amp;amp; perf lab limits||AD0225|Calculation issue: PCHG != (AVAL - BASE)/BASE * 100|Error|16|1|351|5111|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;lt;row 3&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADSL|Subject-Level Analysis|ITTFL|TS0026|Analysis Preferable variable %Variable% not found|Warning|16|1|1|16|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I tried using the solution provided by&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410" target="_blank" rel="noopener"&gt;data_null__&lt;/A&gt;&lt;SPAN&gt;JADE&amp;nbsp; in this &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Splitting-string-variable-into-Multiple-Column/m-p/256539" target="_self"&gt;post&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;to break this record into multiple columns. However, when I use _infile_=line, _infile_ gets truncated.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Here is the program used to read "HAVE"&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;input line $305.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADLB|Lab analysis SI units &amp;amp; perf lab limits||AD0225|Calculation issue: PCHG != (AVAL - BASE)/BASE * 100|Error|16|1|351|5111|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADSL|Subject-Level Analysis|ITTFL|TS0026|Analysis Preferable variable %Variable% not found|Warning|16|1|1|16|Yes|19|97|100|0|0|100|56||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;proc print;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Here is my code, trying to break each record into 41 different columns following the &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Splitting-string-variable-into-Multiple-Column/m-p/256539" target="_self"&gt;solution provided&lt;/A&gt; by data_null__jade.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can copy and paste my code, if you want to replicate the (lack of) results and the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data want;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;infile cards dsd dlm='|' ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;if _n_ eq 1 then input @@;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;set have;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;_infile_ = line;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;put _infile_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;input @1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;job_id&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;validated_gmt:anydtdtm21.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter:$CHAR40.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter_email:$CHAR45.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;project_id&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study_id&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package_id project:$CHAR23.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study:$CHAR35.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;protocol:$CHAR23.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package:$CHAR47.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;standard:$CHAR13.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;meddra&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;snomed:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;whodrug:$CHAR13.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;loinc&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;unii:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;ndf_rt:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;sdtm_ct:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;adam_ct:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;send_ct:anydtdte12.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;dataset:$CHAR46.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;label:$CHAR106.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;variable:$CHAR10.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;rule:$CHAR7.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;message:$CHAR216.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;severity:$CHAR7.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;subjects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;failures&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;datapoints&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;records&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;define_included:$CHAR.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_compliance&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_ct&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_regulatory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_metadata&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_quality&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_analysis&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1:$CHAR200.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1_dt:anydtdtm21.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;@@&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;format &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;job_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;validated_gmt datetime. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter $40. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;submitter_email $45. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;project_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package_id best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;project $23. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;study $35. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;protocol $23. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data_package $47. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;standard $13. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;meddra best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;snomed date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;whodrug $13. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;loinc best4. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;unii date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;ndf_rt date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;sdtm_ct date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;adam_ct date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;send_ct date9. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;dataset $46. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;label $106. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;variable $10. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;rule $7. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;message $216. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;severity $7. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;subjects best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;failures best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;datapoints best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;records best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;define_included $3. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_compliance best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_ct best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_regulatory best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_metadata best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_quality best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;score_analysis best12. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1 $200. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;active_explanation_1_dt datetime.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Necessary evil&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;And here is the log. Notice that the first 7 variables get populated as desired. But starting from the 8th variable, all get null /missing values. Notice the results from the &lt;FONT face="courier new,courier"&gt;put _input_;&lt;/FONT&gt; statement:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#000000"&gt;3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: LOST CARD.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;121 run;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;FONT face="courier new,courier"&gt;line=3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;0|100|56|| &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;job_id=3142 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;validated_gmt=09JUL18:03:24:00 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;submitter=xxxxxx xxxxx - Network &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;submitter_email=xxxx_xxx@work.com&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;project_id=41 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;study_id=266 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;data_package_id=337 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;project=i6a-je &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;study= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;protocol= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;data_package= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;standard= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;meddra=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;snomed=.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;whodrug= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;loinc=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;unii=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;ndf_rt=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;sdtm_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;adam_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;send_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;dataset= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;label= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;variable= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;rule= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;message= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;severity= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;subjects=.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;failures=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;datapoints=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;records=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;define_included= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_compliance=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_ct=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_regulatory=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_metadata=.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_quality=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;score_analysis=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;active_explanation_1= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;active_explanation_1_dt=. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;_ERROR_=1 &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;_INFILE_= &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;_N_=1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: There were 1 observations read from the data set WORK.HAVE.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: The data set WORK.WANT has 0 observations and 42 variables.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 19:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739628#M230877</guid>
      <dc:creator>ruysolo</dc:creator>
      <dc:date>2021-05-06T19:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a very long and delimited string character variable into Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739651#M230889</link>
      <description>&lt;P&gt;First thing, post long lines of code or log entries into a text box opened on the forum with the &amp;lt;/&amp;gt; icon at the top of the message window. The main message windows will reformat text making it quite likely that the pasted result is not what you started with. So we actually can't properly test your code as pasted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this text started out as text file it would likely be easier to read that, just use the INPUT with no @@ and such.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The LOST card and the "&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/FONT&gt;" are telling you that you are attempting to read more variables from a single line of text than are available.&lt;/P&gt;
&lt;P&gt;You can try to fix that by adding the MISSOVER option to the INFILE so that the "extra" variables don't attempt to read from the next line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However your CODE shown does not match the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error message shows&lt;/P&gt;
&lt;PRE&gt;line=3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|0|100|56||
job_id=3142
validated_gmt=09JUL18:03:24:00
submitter=xxxxxx xxxxx - Network
submitter_email=xxxx_xxx@work.com
project_id=41
study_id=266
&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;data_package_id=337&lt;/FONT&gt;&lt;/STRONG&gt;
&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;project=i6a-je
study=&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;Your code on the input statement shows&lt;/P&gt;
&lt;PRE&gt;data_package:$CHAR47.
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;standard:$CHAR13.
meddra&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable reading the value in the error message after data_package is &lt;STRONG&gt;Project &lt;/STRONG&gt;(and used a shorter than $char13. informat), then &lt;STRONG&gt;Study&lt;/STRONG&gt;. The INPUT statement shows variables &lt;STRONG&gt;Standard&lt;/STRONG&gt;, which is what would have read that "16a-je" value and &lt;STRONG&gt;Meddra. &lt;/STRONG&gt;So make sure the errors come from the code matching the invalid data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not quite sure why all that convoluted stuff was the "solution" but your example doesn't need any of that.&lt;/P&gt;
&lt;P&gt;I would start with:&lt;/P&gt;
&lt;PRE&gt;data junk;
infile cards dsd dlm='|' missover;
  input
      job_id
      validated_gmt:anydtdtm21.
      submitter:$CHAR40.
      submitter_email:$CHAR45.
      project_id
      study_id
      data_package_id project:$CHAR23.
      study:$CHAR35.
      protocol:$CHAR23.
      data_package:$CHAR47.
      standard:$CHAR13.
      meddra
      snomed:anydtdte12.
      whodrug:$CHAR13.
      loinc
      unii:anydtdte12.
      ndf_rt:anydtdte12.
      sdtm_ct:anydtdte12.
      adam_ct:anydtdte12.
      send_ct:anydtdte12.
      dataset:$CHAR46.
      label:$CHAR106.
      variable:$CHAR10.
      rule:$CHAR7.
      message:$CHAR216.
      severity:$CHAR7.
      subjects
      failures
      datapoints
      records
      define_included:$CHAR.
      score
      score_compliance
      score_ct
      score_regulatory
      score_metadata
      score_quality
      score_analysis
      active_explanation_1:$CHAR200.
      active_explanation_1_dt:anydtdtm21.
   ;
   format
      validated_gmt datetime.
      snomed date9.
      unii date9.
      ndf_rt date9.
      sdtm_ct date9.
      adam_ct date9.
      send_ct date9.
      active_explanation_1_dt datetime.
   ; 
cards;
3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||AXEX|Exposure Analysis Data Set||AD9999|Dataset %Domain% not validated|Warning|16|1|1|17|Yes|19|97|100|0|0|100|56||
3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADLB|Lab analysis SI units &amp;amp; perf lab limits||AD0225|Calculation issue: PCHG != (AVAL - BASE)/BASE * 100|Error|16|1|351|5111|Yes|19|97|100|0|0|100|56||
3142|2018-07-09 03:24|xxxxxx xxxxx - Network|xxxx_xxx@work.com|41|266|337|i6a-je-cbbh|Shared_cbbh||CBBH ADaM|ADaM-IG 1.0|21.0||||||2016-06-24|2016-03-25||ADSL|Subject-Level Analysis|ITTFL|TS0026|Analysis Preferable variable %Variable% not found|Warning|16|1|1|16|Yes|19|97|100|0|0|100|56||
;
 

 &lt;/PRE&gt;
&lt;P&gt;And since that works just fine instead of parsing your data as is, write it out to a temp text file and then read that text file with the data step:&lt;/P&gt;
&lt;PRE&gt;data _null_;
    file "c:\somefolder\data.txt";
   put linevariablename;
run;

Data want;
   infile  "c:\somefolder\data.txt" dlm='|' missover;
  &amp;lt;the input statement from my previous code that runs just fine&amp;gt;
;&lt;/PRE&gt;
&lt;P&gt;There is not reason to supply format statements for character variables like: Format somevar $35.; unless you intend to display it with fewer characters than they occupy. Similar with BEST12 numeric format, generally that is the SAS default and need not be set.&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, 06 May 2021 21:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739651#M230889</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-06T21:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a very long and delimited string character variable into Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739684#M230905</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381099"&gt;@ruysolo&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I understand your question as follows&lt;/P&gt;
&lt;P&gt;1.You a single character variable named line.&lt;/P&gt;
&lt;P&gt;2.This variable is a collection of number of text tokens or strings delimited by "|"&lt;/P&gt;
&lt;P&gt;3.It is desired to split this line at each of the delimiters into new variables.&lt;/P&gt;
&lt;P&gt;4.You are aware of the number of the text strings/variables in the line.&lt;/P&gt;
&lt;P&gt;Under such a scenario, i would use the following sample/proof of concept code..&lt;/P&gt;
&lt;P&gt;Make appropriate changes as needed.&lt;BR /&gt;It is my understanding that this will serve your purpose.&lt;BR /&gt;If any of these new string variable contains number you should be able to convert it to number using input function.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length line $ 250;
input line $;
datalines;
asdf1|asdf2|asdf3|asdf4|asdf5
lkjh1|lkjh2|lkjh3|lkjh4|lkjh5
;
run;
data test2 (drop=line);
set test;
test1=scan(line,1,"|");
test2=scan(line,2,"|");
test3=scan(line,3,"|");
test4=scan(line,4,"|");
test5=scan(line,5,"|");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output dataset will be like this&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.PNG" style="width: 606px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59122iCA2F5051CC65F628/image-size/large?v=v2&amp;amp;px=999" role="button" title="output.PNG" alt="output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please let me know if you have questions.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 23:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739684#M230905</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-06T23:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a very long and delimited string character variable into Multiple Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739687#M230906</link>
      <description>&lt;P&gt;Issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Use the TRUNCOVER option so that you don't go past the end of the line.&lt;/P&gt;
&lt;P&gt;2) You need to get the LRECL for the infile to be at least as large as the length of the character variable you are using to replace it.&amp;nbsp; That is hard with in-line (aka CARDS aka DATALINES).&amp;nbsp; The LRECL is always a multiple of 80 and the smallest needed for that actual data. Use a real file.&lt;/P&gt;
&lt;P&gt;3) Make sure all INPUT statements use the double trailing&amp;nbsp;@ .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dummy temp;
data _null_;
  file dummy;
  put 'place holder line';
run;
data want;
  infile dummy truncover dsd dlm='|' lrecl=32767;
  if _n_ eq 1 then input @@;
  set have;
  _infile_ = line;
  input @1 
  ....
    @@;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 May 2021 00:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-very-long-and-delimited-string-character-variable/m-p/739687#M230906</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-07T00:39:29Z</dc:date>
    </item>
  </channel>
</rss>

