<?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 create a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10403#M783</link>
    <description>There's a couple of ways you can do it. I'm using instream data in my code, but the data could be in a text file.&lt;BR /&gt;
&lt;BR /&gt;
This is the method that Scott referred to in his post:&lt;BR /&gt;
&lt;BR /&gt;
data method1;&lt;BR /&gt;
input line $40.;&lt;BR /&gt;
length country $8;&lt;BR /&gt;
country = scan( line, -1 );&lt;BR /&gt;
drop line;&lt;BR /&gt;
datalines;&lt;BR /&gt;
THE NAME OF COUNTRY IS INDIA&lt;BR /&gt;
THE NAME OF COUNTRY IS AMERICA&lt;BR /&gt;
THE NAME OF COUNTRY IS LONDON&lt;BR /&gt;
THE NAME OF COUNTRY IS CANADA&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Another alternative:&lt;BR /&gt;
&lt;BR /&gt;
data method2;&lt;BR /&gt;
input @'THE NAME OF COUNTRY IS ' country $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
THE NAME OF COUNTRY IS INDIA&lt;BR /&gt;
THE NAME OF COUNTRY IS AMERICA&lt;BR /&gt;
THE NAME OF COUNTRY IS LONDON&lt;BR /&gt;
THE NAME OF COUNTRY IS CANADA&lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 16 Feb 2011 20:50:09 GMT</pubDate>
    <dc:creator>FloydNevseta</dc:creator>
    <dc:date>2011-02-16T20:50:09Z</dc:date>
    <item>
      <title>how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10398#M778</link>
      <description>I have a  row data like&lt;BR /&gt;
&lt;BR /&gt;
THE NAME OF     COUNTRY  IS  INDIA&lt;BR /&gt;
THE NAME OF  COUNTRY  IS AMERICA&lt;BR /&gt;
THE    NAME OF  COUNTRY  IS  LONDON&lt;BR /&gt;
THE NAME OF COUNTRY  IS  CANADA&lt;BR /&gt;
&lt;BR /&gt;
I have to make a data set which is like &lt;BR /&gt;
&lt;BR /&gt;
name&lt;BR /&gt;
INDIA&lt;BR /&gt;
AMERICA&lt;BR /&gt;
LONDON&lt;BR /&gt;
CANADA&lt;BR /&gt;
&lt;BR /&gt;
Please help me

Message was edited by: arpit</description>
      <pubDate>Tue, 15 Feb 2011 09:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10398#M778</guid>
      <dc:creator>arpit</dc:creator>
      <dc:date>2011-02-15T09:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10399#M779</link>
      <description>Use the SCAN function with -1 as the second argument to select the last word.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
scan function site:sas.com</description>
      <pubDate>Tue, 15 Feb 2011 11:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10399#M779</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-02-15T11:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10400#M780</link>
      <description>The .csv file contain  below data&lt;BR /&gt;
&lt;BR /&gt;
THE                NAME     OF            COUNTRY IS INDIA&lt;BR /&gt;
THE                NAME     OF           COUNTRY  IS AMERICA&lt;BR /&gt;
THE                NAME     OF           COUNTRY  IS LONDON&lt;BR /&gt;
THE                NAME     OF           COUNTRY  IS CANADA&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I have to create a dataset like&lt;BR /&gt;
&lt;BR /&gt;
name&lt;BR /&gt;
INDIA&lt;BR /&gt;
AMERICA&lt;BR /&gt;
LONDON&lt;BR /&gt;
CANADA&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
can u explain me</description>
      <pubDate>Tue, 15 Feb 2011 12:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10400#M780</guid>
      <dc:creator>arpit</dc:creator>
      <dc:date>2011-02-15T12:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10401#M781</link>
      <description>From the data presented, it does not appear to be a "CSV" formatted file.  What is unclear is whether the entire data-string is contained in one cell or multiple?  &lt;BR /&gt;
&lt;BR /&gt;
You can use SAS PROC IMPORT to read the external file -- this process will create a SAS database member/file for you.  Then you can use a SAS DATA step with a SET to read your imported SAS file, and use a SAS character variable assignment statement.  Code a LENGTH or ATTRIB statement to declare the new variable that will contain the sub-string value, and make use of the SCAN function, as shown below:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
oldvar = "A B C D XXXXXXX';&lt;BR /&gt;
length newvar $20;&lt;BR /&gt;
newvar = scan(oldvar,-1,' ');&lt;BR /&gt;
putlog _all_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Suggest using the Google searches below and review SAS-hosted documentation and supplemental technical / conference reference material.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
proc import csv introduction site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
data step programming introduction site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
data step scan function site:sas.com</description>
      <pubDate>Tue, 15 Feb 2011 14:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10401#M781</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-02-15T14:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10402#M782</link>
      <description>Thanks for your kind information &lt;BR /&gt;
&lt;BR /&gt;
But how it use to make a data step like &lt;BR /&gt;
&lt;BR /&gt;
INDIA&lt;BR /&gt;
AMERICA&lt;BR /&gt;
LONDON&lt;BR /&gt;
CANADA

Message was edited by: arpit</description>
      <pubDate>Wed, 16 Feb 2011 01:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10402#M782</guid>
      <dc:creator>arpit</dc:creator>
      <dc:date>2011-02-16T01:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10403#M783</link>
      <description>There's a couple of ways you can do it. I'm using instream data in my code, but the data could be in a text file.&lt;BR /&gt;
&lt;BR /&gt;
This is the method that Scott referred to in his post:&lt;BR /&gt;
&lt;BR /&gt;
data method1;&lt;BR /&gt;
input line $40.;&lt;BR /&gt;
length country $8;&lt;BR /&gt;
country = scan( line, -1 );&lt;BR /&gt;
drop line;&lt;BR /&gt;
datalines;&lt;BR /&gt;
THE NAME OF COUNTRY IS INDIA&lt;BR /&gt;
THE NAME OF COUNTRY IS AMERICA&lt;BR /&gt;
THE NAME OF COUNTRY IS LONDON&lt;BR /&gt;
THE NAME OF COUNTRY IS CANADA&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Another alternative:&lt;BR /&gt;
&lt;BR /&gt;
data method2;&lt;BR /&gt;
input @'THE NAME OF COUNTRY IS ' country $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
THE NAME OF COUNTRY IS INDIA&lt;BR /&gt;
THE NAME OF COUNTRY IS AMERICA&lt;BR /&gt;
THE NAME OF COUNTRY IS LONDON&lt;BR /&gt;
THE NAME OF COUNTRY IS CANADA&lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 16 Feb 2011 20:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10403#M783</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2011-02-16T20:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10404#M784</link>
      <description>Hi:&lt;BR /&gt;
How about it:&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename csv 'c:\test.csv';&lt;BR /&gt;
data want;&lt;BR /&gt;
 infile csv length=len;&lt;BR /&gt;
 input whole $varying200. len;&lt;BR /&gt;
 country=scan(whole,-1);&lt;BR /&gt;
 drop whole;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 24 Feb 2011 06:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-dataset/m-p/10404#M784</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-24T06:04:45Z</dc:date>
    </item>
  </channel>
</rss>

