<?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 from a header file and a data file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134597#M27340</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Tom, for your quick response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My datafile.txt has about 60000 columns and does not have any delimiter (column input data). Does PROC IMPORT work on data without a delimiter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jul 2014 15:28:23 GMT</pubDate>
    <dc:creator>krishmar1</dc:creator>
    <dc:date>2014-07-24T15:28:23Z</dc:date>
    <item>
      <title>How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134589#M27332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a text file with the header information (all the variable names in one column) and another text file with the data (all the observations).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I create a SAS data set from these two files?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 00:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134589#M27332</guid>
      <dc:creator>krishmar1</dc:creator>
      <dc:date>2014-07-24T00:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134590#M27333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way is to read the data using generic names like VAR1-VAR100 and then use the names from the other file to generate rename statements.&lt;/P&gt;&lt;P&gt;Another is read in the names and use them to generate the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's take the simple case of 10 columns of data where every column is a number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile 'two.txt' truncover ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input name $32.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; oldname = cats('var',_n_);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select catx('=',oldname,name) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :rename separated by ' '&lt;/P&gt;&lt;P&gt; from names&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data numbers ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile 'two.txt' dsd dlm=',' truncover ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input var1-var10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rename &amp;amp;rename ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 00:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134590#M27333</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-24T00:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134591#M27334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow, it worked!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much, Tom. You rock!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 01:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134591#M27334</guid>
      <dc:creator>krishmar1</dc:creator>
      <dc:date>2014-07-24T01:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134592#M27335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a more direct approach, you could skip the 'rename' as to (stem code was stolen shamelessly from Tom's code):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'varname.txt'&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=last;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; temp $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;2000&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$32.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; temp = catx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,temp,name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; last &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; symputx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'name'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,temp);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; numbers ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'data.txt'&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dsd&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;','&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 01:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134592#M27335</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-07-24T01:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134593#M27336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hai.kuo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How does this code account for character variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see how it works for numeric, but not character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 04:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134593#M27336</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2014-07-24T04:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134594#M27337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott,&lt;/P&gt;&lt;P&gt;I would try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; numbers ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'data.txt'&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dsd&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;','&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; (&amp;amp;name) (:&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$200.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;So you want to set a large enough length to cover the maximum length of any possible variables. But again, this would be all Char. if mixed with num and char, then obviously more information will be needed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 12:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134594#M27337</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-07-24T12:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134595#M27338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Hai.Kuo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a follow-up question: how do I read column input data without a header from a text file into a SAS data set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 14:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134595#M27338</guid>
      <dc:creator>krishmar1</dc:creator>
      <dc:date>2014-07-24T14:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134596#M27339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can let PROC IMPORT read the file for you.&amp;nbsp; It has an option to tell not to look for a header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile="C:\My Documents\myfiles\delimiter.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp; dbms=dlm&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=mydata&lt;/P&gt;&lt;P&gt;&amp;nbsp; replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp; delimiter=',';&lt;/P&gt;&lt;P&gt;&amp;nbsp; getnames=NO;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use this instead of the data step in my original answer and then use the trick to generate a RENAME statement to change the variable names.&lt;/P&gt;&lt;P&gt;Watch out though as PROC IMPORT will have to guess at what type of data is in each column.&amp;nbsp; If you already know the data types then write your own data step so you can control the types yourself.&amp;nbsp; Personally for your example if the number of columns is small (&amp;lt;30 perhaps) I would just pull the list of names into a program editor and use it to create the data step.&amp;nbsp; For example you could use the list of names in a LENGTH statement and assign the length (numeric variables should always use length of 8).&amp;nbsp; If you have any formatted data like DATE or TIME variables then also add an INFORMAT and FORMAT statement for them.&amp;nbsp; Then in the actual INPUT statement you can either list all the variables again or just use variable list using double hyphen so that you only need to retype the first and last variable name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'mydata.txt' dsd trucnover;&lt;/P&gt;&lt;P&gt;length &lt;/P&gt;&lt;P&gt;&amp;nbsp; NAME $20&lt;/P&gt;&lt;P&gt;&amp;nbsp; AGE 8&lt;/P&gt;&lt;P&gt;&amp;nbsp; SEX $1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt; input NAME -- AGE ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 15:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134596#M27339</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-24T15:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134597#M27340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Tom, for your quick response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My datafile.txt has about 60000 columns and does not have any delimiter (column input data). Does PROC IMPORT work on data without a delimiter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 15:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134597#M27340</guid>
      <dc:creator>krishmar1</dc:creator>
      <dc:date>2014-07-24T15:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134598#M27341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Krishna, you need to declare your delimiter in this line.&lt;/P&gt;&lt;P&gt;"&lt;STRONG&gt;delimiter=',';&lt;/STRONG&gt;"&amp;nbsp; ,in this case the delimiter is ( &lt;STRONG&gt;,&lt;/STRONG&gt; ). At the end of each column, you need a comma in your text file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile="C:\My Documents\myfiles\delimiter.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp; dbms=dlm&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=mydata&lt;/P&gt;&lt;P&gt;&amp;nbsp; replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;delimiter=',';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; getnames=NO;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case you don´t have any delimiter, you need to declare the beginning and the end of each column or your size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'mydata.txt' dsd trucnover;&lt;/P&gt;&lt;P&gt;length &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; NAME $20&amp;nbsp; &amp;lt;-- This number represents the number of columns that your variable has.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; AGE 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; SEX $1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt; input NAME -- AGE ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is that correct Tom ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Wagner.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 19:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134598#M27341</guid>
      <dc:creator>wamorgao</dc:creator>
      <dc:date>2014-07-24T19:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134599#M27342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your response, Wagner. I still have an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the values in the data set are 1s , 0s or blanks, except for the ID column. I tried the following ways but the data are not getting read correctly:&lt;/P&gt;&lt;P&gt;(1)&lt;/P&gt;&lt;P&gt;LENGTH ID $10 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR1 $1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR2 $1;&lt;/P&gt;&lt;P&gt;INPUT ID -- VAR2;&lt;/P&gt;&lt;P&gt;(2)&lt;/P&gt;&lt;P&gt;LENGTH ID $10 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR1 $1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR2 $1;&lt;/P&gt;&lt;P&gt;INPUT @1 ID $&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @11 VAR1 $&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @12 VAR2 $;&lt;/P&gt;&lt;P&gt;(3)&lt;/P&gt;&lt;P&gt;LENGTH ID $10 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR1 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR2 3;&lt;/P&gt;&lt;P&gt;INPUT @1 ID $&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @11 VAR1 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @12 VAR2 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you tell me which length and input statements work best for data with 1s, 0s and blanks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 21:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134599#M27342</guid>
      <dc:creator>krishmar1</dc:creator>
      <dc:date>2014-07-24T21:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134600#M27343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never mind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I figured this out, finally!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 22:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134600#M27343</guid>
      <dc:creator>krishmar1</dc:creator>
      <dc:date>2014-07-24T22:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dataset from a header file and a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134601#M27344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So if the data is in fixed columns then that is also simple with SAS.&lt;/P&gt;&lt;P&gt;You could tell SAS to read from specific columns (input ID $ 1-10) or tell it to use a specific format (input ID $10.).&lt;/P&gt;&lt;P&gt;I would use formatted mode so that I did not need to type all of the column numbers.&lt;/P&gt;&lt;P&gt;If you input your non-id variables as numeric then it will treat '1' as the number one , '0' as the number zero, and ' ' as a missing value.&lt;/P&gt;&lt;P&gt;So if you have a 10 character ID value and then 20 one character variables then you could write:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; infile 'myfile.txt' truncover ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input id $10. (var1-var20) (1.) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 22:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-dataset-from-a-header-file-and-a-data-file/m-p/134601#M27344</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-24T22:03:29Z</dc:date>
    </item>
  </channel>
</rss>

