<?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: Import CSV : Make Slash information as a new lilne in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647796#M19210</link>
    <description>&lt;P&gt;If by "on import" you mean use of Proc Import you would do that in a separate data step.&lt;/P&gt;
&lt;P&gt;If you have a data step to read the file then AFTER the Input statements in you code you could modify it to do something like:&lt;/P&gt;
&lt;PRE&gt;data want;
   infile &amp;lt;options&amp;gt;;
   input &amp;lt;variables&amp;gt;
   ;
   &amp;lt;anyother code you want to run 
    before splitting the variable
   &amp;gt;
   length shortvar $  5; /*&amp;lt;= this lenght should be
                         set to hold the longest piece
                         */
   do i= 1 to countw(longvar,'/');
      shortvar = scan(longvar,i,'/');
      output;
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;If you already have the data set, or have used import to create a data set then the above code becomes:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   length shortvar $  5; /*&amp;lt;= this lenght should be
                         set to hold the longest piece
                         */
   do i= 1 to countw(longvar,'/');
      shortvar = scan(longvar,i,'/');
      output;
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;where have is the name of the set you created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: the new variable will not be the second column in any of the results.&lt;/P&gt;
&lt;P&gt;If you think that column order is critical then 1) it really seldom is and 2) that question has been addressed many times on this forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 May 2020 13:08:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-14T13:08:55Z</dc:date>
    <item>
      <title>Import CSV : Make Slash information as a new lilne</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647734#M19208</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a csv file such as some rows are like this (always on the second columns) :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 300pt;" border="0" width="400" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="46.4px" height="20" align="right" style="height: 15.0pt; width: 60pt;"&gt;6088&lt;/TD&gt;
&lt;TD width="202.4px" style="width: 60pt;"&gt;06000/06100/06200/06300&lt;/TD&gt;
&lt;TD width="72px" style="width: 60pt;"&gt;BLABLA&lt;/TD&gt;
&lt;TD width="59.2px" style="width: 60pt;"&gt;BLIBLI&lt;/TD&gt;
&lt;TD width="75.2px" style="width: 60pt;"&gt;BLOBLO&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And i'd like that when I import it on SAS, I obtain (for this piece of information) :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse;" border="0" width="519px" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="78px" height="20" align="right" style="height: 15.0pt; width: 60pt;"&gt;
&lt;P&gt;6088&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="202px" style="width: 60pt;"&gt;06000&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLABLA&lt;/TD&gt;
&lt;TD width="79px" style="width: 60pt;"&gt;BLIBLI&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;
&lt;P&gt;BLOBLO&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="78px" height="20" align="right" style="height: 15.0pt; width: 60pt;"&gt;6088&lt;/TD&gt;
&lt;TD width="202px" style="width: 60pt;"&gt;06100&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLABLA&lt;/TD&gt;
&lt;TD width="79px" style="width: 60pt;"&gt;BLIBLI&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLOBLO&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="78px" height="20" align="right" style="height: 15.0pt; width: 60pt;"&gt;6088&lt;/TD&gt;
&lt;TD width="202px" style="width: 60pt;"&gt;06200&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLABLA&lt;/TD&gt;
&lt;TD width="79px" style="width: 60pt;"&gt;BLIBLI&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLOBLO&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="78px" height="20" align="right" style="height: 15.0pt; width: 60pt;"&gt;6088&lt;/TD&gt;
&lt;TD width="202px" style="width: 60pt;"&gt;06300&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLABLA&lt;/TD&gt;
&lt;TD width="79px" style="width: 60pt;"&gt;BLIBLI&lt;/TD&gt;
&lt;TD width="80px" style="width: 60pt;"&gt;BLOBLO&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 09:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647734#M19208</guid>
      <dc:creator>Mathis1</dc:creator>
      <dc:date>2020-05-14T09:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV : Make Slash information as a new lilne</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647795#M19209</link>
      <description>&lt;P&gt;Please post the REAL contents of your CSV file by copy/pasting into a window opened with &amp;lt;/&amp;gt;:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.png"&gt;&lt;img src="https://communities.sas.com/skins/images/70F8802BAA6255D55FBEC62A8226FB10/responsive_peak/images/image_not_found.png" alt="Bildschirmfoto 2020-04-07 um 08.32.59.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do NOT open the csv file with Excel or similar; use a text editor (Windows Editor or Notepad++).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few lines (including an eventual header) should be enough.&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 13:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647795#M19209</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-14T13:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV : Make Slash information as a new lilne</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647796#M19210</link>
      <description>&lt;P&gt;If by "on import" you mean use of Proc Import you would do that in a separate data step.&lt;/P&gt;
&lt;P&gt;If you have a data step to read the file then AFTER the Input statements in you code you could modify it to do something like:&lt;/P&gt;
&lt;PRE&gt;data want;
   infile &amp;lt;options&amp;gt;;
   input &amp;lt;variables&amp;gt;
   ;
   &amp;lt;anyother code you want to run 
    before splitting the variable
   &amp;gt;
   length shortvar $  5; /*&amp;lt;= this lenght should be
                         set to hold the longest piece
                         */
   do i= 1 to countw(longvar,'/');
      shortvar = scan(longvar,i,'/');
      output;
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;If you already have the data set, or have used import to create a data set then the above code becomes:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   length shortvar $  5; /*&amp;lt;= this lenght should be
                         set to hold the longest piece
                         */
   do i= 1 to countw(longvar,'/');
      shortvar = scan(longvar,i,'/');
      output;
   end;
   drop i;
run;&lt;/PRE&gt;
&lt;P&gt;where have is the name of the set you created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: the new variable will not be the second column in any of the results.&lt;/P&gt;
&lt;P&gt;If you think that column order is critical then 1) it really seldom is and 2) that question has been addressed many times on this forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 13:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647796#M19210</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-14T13:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV : Make Slash information as a new lilne</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647808#M19211</link>
      <description>It totally did the job, thank you ! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;</description>
      <pubDate>Thu, 14 May 2020 13:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647808#M19211</guid>
      <dc:creator>Mathis1</dc:creator>
      <dc:date>2020-05-14T13:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV : Make Slash information as a new lilne</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647817#M19212</link>
      <description>&lt;P&gt;Actually I have one more issue ^^&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My new variable (&lt;EM&gt;shortvar&lt;/EM&gt;) doesn't take into account the leading zeros. So in my example, I get :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shortvar&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;6000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;6100&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;6200&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;6300&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;instead of :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Shortvar&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;06000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;06100&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;06200&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;06300&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;&lt;SPAN&gt;I tried :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data Want;&lt;BR /&gt;set Have;&lt;BR /&gt;length shortvar $5.;&lt;BR /&gt;Put shortvar z5.;&lt;BR /&gt;do i= 1 to countw(longvar,'/');&lt;BR /&gt;CodePostal = put(scan(longvar,i,'/'),z5.);&lt;BR /&gt;output;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But I have the error message :&amp;nbsp;The format $Z was not found or could not be loaded.&lt;BR /&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>Thu, 14 May 2020 14:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647817#M19212</guid>
      <dc:creator>Mathis1</dc:creator>
      <dc:date>2020-05-14T14:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV : Make Slash information as a new lilne</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647832#M19213</link>
      <description>&lt;P&gt;I solved it actually, thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 14:47:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Import-CSV-Make-Slash-information-as-a-new-lilne/m-p/647832#M19213</guid>
      <dc:creator>Mathis1</dc:creator>
      <dc:date>2020-05-14T14:47:56Z</dc:date>
    </item>
  </channel>
</rss>

