<?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: Creating dataset with long strings containing spaces in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604783#M18418</link>
    <description>What if I want to add second variable like "id" (2,3,4...)?</description>
    <pubDate>Sun, 17 Nov 2019 10:55:38 GMT</pubDate>
    <dc:creator>ab97_cd</dc:creator>
    <dc:date>2019-11-17T10:55:38Z</dc:date>
    <item>
      <title>Creating dataset with long strings containing spaces</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604781#M18416</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I create dataset in which "schools" variable will be in one column?&lt;/P&gt;&lt;P&gt;My code is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data aaa;
input  schools $;
datalines;
harvard and oxford
only harvard should be chosen
cheese, cake, pizza
we dont't have any values
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My results are:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 233px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34034i45F0E671ACE804F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2019 10:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604781#M18416</guid>
      <dc:creator>ab97_cd</dc:creator>
      <dc:date>2019-11-17T10:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dataset with long strings containing spaces</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604782#M18417</link>
      <description>&lt;P&gt;Something like below should do the job.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data aaa;
  infile datalines truncover;
  input  schools $100.;
  datalines;
harvard and oxford
only harvard should be chosen
cheese, cake, pizza
we dont't have any values
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Nov 2019 10:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604782#M18417</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-17T10:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dataset with long strings containing spaces</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604783#M18418</link>
      <description>What if I want to add second variable like "id" (2,3,4...)?</description>
      <pubDate>Sun, 17 Nov 2019 10:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604783#M18418</guid>
      <dc:creator>ab97_cd</dc:creator>
      <dc:date>2019-11-17T10:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dataset with long strings containing spaces</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604799#M18423</link>
      <description>&lt;P&gt;The easiest way to read in multiple variables where some of the values can contain spaces is to use some other character as the delimiter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  length name $20 age weight 8;
  infile cards dsd dlm='|' truncover ;
  input name age weight ;
cards;
Joe Smith|50|200
Sam Jones|30|120
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also make sure that there is as most one space in the middle of the value and at least two spaces after the value. Then you could use the &amp;amp; modifier on the INPUT statement.&amp;nbsp; But that is usually harder to maintain.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  length name $20 age weight 8;
  input name &amp;amp; age weight ;
cards;
Joe Smith  50 200
Sam Jones  30 120
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Nov 2019 15:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-dataset-with-long-strings-containing-spaces/m-p/604799#M18423</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-17T15:31:55Z</dc:date>
    </item>
  </channel>
</rss>

