<?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 Creating variables dynamically in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17228#M3252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the data file have a header record that contains the variable names?&amp;nbsp; Have you tried using proc import, indicating that it is a csv file?&amp;nbsp; Have you looked at the raw file with a text editor like Wordpad (not Notepad, as it has a hard time with large files)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Dec 2011 13:20:38 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-12-19T13:20:38Z</dc:date>
    <item>
      <title>Creating variables dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17227#M3251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to import data from txt file into sas system.&lt;/P&gt;&lt;P&gt;The size of raw data file is to big,and the length of the record is also to big,what i know is that the values are separated by comma.&lt;/P&gt;&lt;P&gt;What problem i am facing is that i dont know how my variables values it holds in a record.it many 120 variables or even mre then that.&lt;/P&gt;&lt;P&gt;i want to access a variable values and want to create sas data set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 06:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17227#M3251</guid>
      <dc:creator>sss</dc:creator>
      <dc:date>2011-12-19T06:52:58Z</dc:date>
    </item>
    <item>
      <title>Creating variables dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17228#M3252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the data file have a header record that contains the variable names?&amp;nbsp; Have you tried using proc import, indicating that it is a csv file?&amp;nbsp; Have you looked at the raw file with a text editor like Wordpad (not Notepad, as it has a hard time with large files)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 13:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17228#M3252</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-12-19T13:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating variables dynamically</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17229#M3253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can explore the content of your text file with SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to see what it looks like use the LIST statement in a data step.&amp;nbsp; If there are any non-printable characters in the lines then SAS will show you the hex codes for those characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Dump first 5 lines to the log ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'myfile.txt' lrecl=32676 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; list;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if _n_ &amp;gt;= 5 then stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know that it is comma delimited then you try just pulling in a few rows into character variables and see what you have .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Pull in first 50 columns for first 10 rows ;&lt;/P&gt;&lt;P&gt;data sample ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'myfile.txt' dsd dlm=','&amp;nbsp; truncover lrecl=32676 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length x1-x50 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input x1-x50 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if _n_ &amp;gt;= 10 then stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have figured out how to read it and due to space issues you only want to keep a couple of columns then you could use a KEEP (or DROP) statement or dataset option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data subset (keep=id age sex);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'myfile.txt' dsd dlm=',' truncover ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input id start end age weight height sex comment ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 13:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-variables-dynamically/m-p/17229#M3253</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-19T13:50:45Z</dc:date>
    </item>
  </channel>
</rss>

