<?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: Defining Variable Name using Infile Statement in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68319#M19566</link>
    <description>Given your post, it's unclear how you would expect to associate variable names, other than having the information either in the input-data file (typically as the first/header row) or by using logic in your SAS DATA step (you mentioned INFILE) program code-piece?&lt;BR /&gt;
&lt;BR /&gt;
Suggest you share a simplified data-sample (raw input) and also share what you expect to see (SAS dataset/member/table result) as the outcome from your INFILE processing?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
intro data step programming site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
proc import site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
input data step site:sas.com</description>
    <pubDate>Sun, 29 Aug 2010 18:19:15 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-08-29T18:19:15Z</dc:date>
    <item>
      <title>Defining Variable Name using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68318#M19565</link>
      <description>Hello All, &lt;BR /&gt;
&lt;BR /&gt;
 I have got a dataset which is in a text file and has around 400 variables and more than 10,000 records. I want to import this file in SAS and I will be using Infile for importing the dataset. But for using Infile we need to define the variable names in the dataset which in my case is not defined. &lt;BR /&gt;
&lt;BR /&gt;
Now as there are around 400 variables is there any easy way of defining the variables in the Infile format ? &lt;BR /&gt;
&lt;BR /&gt;
(Plz guide me if I have posted this question in a wrong section)&lt;BR /&gt;
&lt;BR /&gt;
Waiting for the reply. &lt;BR /&gt;
&lt;BR /&gt;
Thanks!

Message was edited by: Pritish</description>
      <pubDate>Sun, 29 Aug 2010 17:20:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68318#M19565</guid>
      <dc:creator>Pritish</dc:creator>
      <dc:date>2010-08-29T17:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Defining Variable Name using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68319#M19566</link>
      <description>Given your post, it's unclear how you would expect to associate variable names, other than having the information either in the input-data file (typically as the first/header row) or by using logic in your SAS DATA step (you mentioned INFILE) program code-piece?&lt;BR /&gt;
&lt;BR /&gt;
Suggest you share a simplified data-sample (raw input) and also share what you expect to see (SAS dataset/member/table result) as the outcome from your INFILE processing?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
intro data step programming site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
proc import site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
input data step site:sas.com</description>
      <pubDate>Sun, 29 Aug 2010 18:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68319#M19566</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-29T18:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Defining Variable Name using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68320#M19567</link>
      <description>Scott, &lt;BR /&gt;
&lt;BR /&gt;
 Thanks for the reply. Here is a sample raw input which you are looking for: &lt;BR /&gt;
&lt;BR /&gt;
0.2,0.5,31,46,57,9.4,7.5&lt;BR /&gt;
1.3,2.3,20,55,91,4.3,3.0&lt;BR /&gt;
&lt;BR /&gt;
I have comma separated value in my txt file. I have in all around 400 variable with a similar values. So what I am trying to do is to import the dataset in SAS using Infile statement. Now the format for infile statement is like&lt;BR /&gt;
&lt;BR /&gt;
DATA WORK.dataset.name;&lt;BR /&gt;
INFILE "Path.txt" DELIMITER=','x;&lt;BR /&gt;
INPUT var1 var2 var3;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
I want my dataset in SAS to be like: &lt;BR /&gt;
&lt;BR /&gt;
Var1  Var2  Var3  Var4 ..... Varn&lt;BR /&gt;
0.2     0.5    31     46     .... &lt;BR /&gt;
1.3     2.3    20     55&lt;BR /&gt;
&lt;BR /&gt;
It's not feasible to write all 400 variable name in the Input step right ? &lt;BR /&gt;
&lt;BR /&gt;
So can you suggest me a better way for this ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the help.</description>
      <pubDate>Mon, 30 Aug 2010 02:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68320#M19567</guid>
      <dc:creator>Pritish</dc:creator>
      <dc:date>2010-08-30T02:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Defining Variable Name using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68321#M19568</link>
      <description>Why don't you try proc import?  E.g.,:&lt;BR /&gt;
&lt;BR /&gt;
PROC IMPORT OUT= WORK.WANT &lt;BR /&gt;
            DATAFILE= "c:\path.txt" &lt;BR /&gt;
            DBMS=DLM REPLACE;&lt;BR /&gt;
     DELIMITER='2C'x; &lt;BR /&gt;
     GETNAMES=NO;&lt;BR /&gt;
     DATAROW=1; &lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
      <pubDate>Mon, 30 Aug 2010 03:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68321#M19568</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-08-30T03:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Defining Variable Name using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68322#M19569</link>
      <description>&amp;gt; Hello All, &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I have got a dataset which is in a text file and has&lt;BR /&gt;
&amp;gt; around 400 variables and more than 10,000 records. I&lt;BR /&gt;
&amp;gt; want to import this file in SAS and I will be using&lt;BR /&gt;
&amp;gt; Infile for importing the dataset. But for using&lt;BR /&gt;
&amp;gt; Infile we need to define the variable names in the&lt;BR /&gt;
&amp;gt;  dataset which in my case is not defined. &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Now as there are around 400 variables is there any&lt;BR /&gt;
&amp;gt; easy way of defining the variables in the Infile&lt;BR /&gt;
&amp;gt; format ? &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; (Plz guide me if I have posted this question in a&lt;BR /&gt;
&amp;gt; wrong section)&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Waiting for the reply. &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks!&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Message was edited by: Pritish&lt;BR /&gt;
&lt;BR /&gt;
data output_dataset ;&lt;BR /&gt;
infile 'where.ever' dsd ......... what ever options needed like lrecl= and firstobs= ;&lt;BR /&gt;
length var1-var400 8 ;&lt;BR /&gt;
input var1-var400 ;&lt;BR /&gt;
run ;&lt;BR /&gt;
if var25 is string length 10, then your code might change only at&lt;BR /&gt;
length var1-var24 8 var25 $10 var25-var400 8 ;</description>
      <pubDate>Mon, 30 Aug 2010 17:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68322#M19569</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-08-30T17:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Defining Variable Name using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68323#M19570</link>
      <description>Art, &lt;BR /&gt;
&lt;BR /&gt;
 Thanks for the reply. It really worked. &lt;BR /&gt;
&lt;BR /&gt;
 Thanks for the help !</description>
      <pubDate>Mon, 30 Aug 2010 20:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Defining-Variable-Name-using-Infile-Statement/m-p/68323#M19570</guid>
      <dc:creator>Pritish</dc:creator>
      <dc:date>2010-08-30T20:48:14Z</dc:date>
    </item>
  </channel>
</rss>

