<?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: data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100998#M28335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah. But you need to know which obs should be started, if it is varying ?&lt;/P&gt;&lt;P&gt;For the missing obs, it is usually unuseful. thus delete them is not a bad idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2012 05:45:58 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-05-03T05:45:58Z</dc:date>
    <item>
      <title>data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100988#M28325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have data from&amp;nbsp; 15 th row onwards&lt;BR /&gt;15th row-----column names&lt;BR /&gt;16 the row----data exists&lt;BR /&gt;i tried this code&lt;/P&gt;&lt;P&gt;proc import datafile=' '&lt;BR /&gt; out=&lt;BR /&gt; dbms=csv &lt;BR /&gt;replace;&lt;BR /&gt;DATAROW=16;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;How to get column names?&lt;BR /&gt;in the output table it is showing var1 var2 ............................................&lt;BR /&gt;i want column names also&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 10:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100988#M28325</guid>
      <dc:creator>sasemp999</dc:creator>
      <dc:date>2012-05-02T10:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100989#M28326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm, not so fast. Noticing the variable names are on 15th row, while getnames=yes will take the first row as the variable names. I suspect that proc import probably can't meet OP's need on this aspect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 11:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100989#M28326</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-05-02T11:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100990#M28327</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;Try this...but not by using proc import&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data WORK.TEST1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile 'C:\Documents and Settings\test\Desktop\test1.csv' delimiter = ',' MISSOVER DSD&lt;/P&gt;&lt;P&gt;&amp;nbsp; lrecl=32767 firstobs=16 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat name1 $6. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat no best32. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format name1 $6. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format no best12. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name1 $&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 11:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100990#M28327</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-05-02T11:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100991#M28328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It should work. When getnames=yes, the default value for datarows is 2. So if datarows=16 then the variable names should come from row 15 when getnames=yes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 11:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100991#M28328</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-05-02T11:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100992#M28329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you sure about that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile='h:\test.txt' out=test&lt;/P&gt;&lt;P&gt;dbms=csv&lt;/P&gt;&lt;P&gt;replace;&lt;/P&gt;&lt;P&gt;getnames=yes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datarow=5;&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;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 11:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100992#M28329</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-05-02T11:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100993#M28330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was wrong. Just tested it myself. Getnames always gets the variable names from the first row.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 12:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100993#M28330</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-05-02T12:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100994#M28331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So it looks like the proc import can not really meet what you need. if you can not modify the input csv file, you could try data step to do the job:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename test 'h:\test.txt';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile test dsd truncover firstobs=15 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('in',translate(_infile_,' ',','));&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile test dsd truncover firstobs=16;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input (&amp;amp;in) (:$20.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you the variable names, however, they will be all character type with the same length of 20.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 13:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100994#M28331</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-05-02T13:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100995#M28332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;filename x&amp;nbsp; 'c:\data.csv';
filename xx temp;
data _null_;
infile x;
file xx;
input;
if not missing(_infile_) then put _infile_;
run;
proc import datafile=xx out=test
dbms=csv
replace;
getnames=yes;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 04:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100995#M28332</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-03T04:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100996#M28333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the FIRSTOBS option on the INFILE X statement to skip over the lines before the data block.&amp;nbsp; That eliminates the need to skip blank lines and also handles cases where the lines to be skipped are not blank.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 05:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100996#M28333</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-03T05:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100997#M28334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is not hard to read the name row yourself and generate code that will rename the default VAR1,VAR2,.... that IMPORT uses when GETNAMES=no.&lt;/P&gt;&lt;P&gt;The data step below will read the name and generate a macro variable with the value needed for a rename statement or rename dataset option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let datarow=6;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let namesrow=5;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; length rename $32767 name $32 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; infile tmpfile1 firstobs=&amp;amp;namesrow dsd truncover;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; do _n_=1 by 1 until (name = ' ');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input name @@ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name ne ' ' then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename=catx(' ',rename,catx('=',cats('var',_n_),name));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; call symputx('rename',rename);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; stop;&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc import file=tmpfile1 out=test1(rename=(&amp;amp;rename))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; dbms=csv replace ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; datarow=&amp;amp;datarow;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; getnames=no;&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, 03 May 2012 05:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100997#M28334</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-03T05:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100998#M28335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah. But you need to know which obs should be started, if it is varying ?&lt;/P&gt;&lt;P&gt;For the missing obs, it is usually unuseful. thus delete them is not a bad idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 05:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data/m-p/100998#M28335</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-03T05:45:58Z</dc:date>
    </item>
  </channel>
</rss>

