<?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: Reg:Text Files importing at once from a folder to  SAS Datasets. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54767#M15196</link>
    <description>The possible solution is to check date and time of creation of the text files and then read these files to SAS dataset.&lt;BR /&gt;
&lt;BR /&gt;
The code below is reading file attributes (date and time) to sas dataset.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
 %let input=d:\dep\input\2010;&lt;BR /&gt;
 %let dir=%str(%'dir %")&amp;amp;input.%str(\%" /A-D/-C/ON/TW/4 %');&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 filename myfiles pipe %unquote(&amp;amp;dir);&lt;BR /&gt;
 data list1 (compress=no);&lt;BR /&gt;
 infile myfiles truncover ;&lt;BR /&gt;
 informat date ddmmyy10. time1 $5. bytes 8. name $100. ;&lt;BR /&gt;
 input date ?? @1 @; if not missing(date) then do;&lt;BR /&gt;
 input  time1 13-17  bytes  19-35  name @37;&lt;BR /&gt;
 end; else delete;&lt;BR /&gt;
 time=input(time1,time5.);&lt;BR /&gt;
 format date ddmmyy10. time hhmm.; drop time1;&lt;BR /&gt;
 run;&lt;BR /&gt;
 filename myfiles clear;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
    <pubDate>Fri, 23 Jul 2010 11:38:28 GMT</pubDate>
    <dc:creator>Oleg_L</dc:creator>
    <dc:date>2010-07-23T11:38:28Z</dc:date>
    <item>
      <title>Reg:Text Files importing at once from a folder to  SAS Datasets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54764#M15193</link>
      <description>Hi&lt;BR /&gt;
I am having 40 text files in a folder with all same variables now i want to create all Text files to sas datasets with the name of the Text file names,how can i do for all them at once the text files are of differnt names a1,mmk,gds,9678c,kl89. As again the text files will be dumped day by day as the no will increse to 5000 how can i do for this.</description>
      <pubDate>Fri, 23 Jul 2010 09:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54764#M15193</guid>
      <dc:creator>sas_</dc:creator>
      <dc:date>2010-07-23T09:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:Text Files importing at once from a folder to  SAS Datasets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54765#M15194</link>
      <description>You want as many SAS datasets as you have text files?&lt;BR /&gt;
Do I understand you correctly?&lt;BR /&gt;
&lt;BR /&gt;
Then try this code. Just change the input block according to your data.&lt;BR /&gt;
&lt;BR /&gt;
  [pre]                                                                                                                                 &lt;BR /&gt;
                                                                                                                                        &lt;BR /&gt;
  %let cfindir=d:\mbm\2010\m01\input; /* your input directory with text files*/                                                         &lt;BR /&gt;
  libname out v9 'd:\work';     /* your library for output datasets */                                                                  &lt;BR /&gt;
                                                                                                                                        &lt;BR /&gt;
                                                                                                                                        &lt;BR /&gt;
  %macro cfin;                                                                                                                          &lt;BR /&gt;
  %let dlm=\;                                                                                                                           &lt;BR /&gt;
  %let filrf=mydir;                                                                                                                     &lt;BR /&gt;
  %let rc=%sysfunc(filename(filrf,"&amp;amp;cfindir"));                                                                                         &lt;BR /&gt;
  %let did=%sysfunc(dopen(&amp;amp;filrf));                                                                                                     &lt;BR /&gt;
  %let lstname=;                                                                                                                        &lt;BR /&gt;
   %let memcount=%sysfunc(dnum(&amp;amp;did));                                                                                                  &lt;BR /&gt;
  %if &amp;amp;memcount &amp;gt; 0 %then %do;                                                                                                          &lt;BR /&gt;
  %do i=1 %to &amp;amp;memcount;                                                                                                                &lt;BR /&gt;
  %let lstname=%sysfunc(dread(&amp;amp;did,&amp;amp;i));                                                                                                &lt;BR /&gt;
  %let file=&amp;amp;cfindir&amp;amp;dlm&amp;amp;lstname;                                                                                                       &lt;BR /&gt;
  %let ln1=%index(&amp;amp;lstname,.);                                                                                                          &lt;BR /&gt;
  %let ln1=%eval(&amp;amp;ln1-1);                                                                                                               &lt;BR /&gt;
  %let ln2=%substr(&amp;amp;lstname,1,&amp;amp;ln1);                                                                                                    &lt;BR /&gt;
  data out.&amp;amp;ln2 ;                                                                                                                       &lt;BR /&gt;
  infile "&amp;amp;file" firstobs=3 dlm=';' ls=32000 truncover dsd;                                                                             &lt;BR /&gt;
  informat account $20. ss_naim $100. var1-var5 $1. ss_ostd 17. ss_ostc 17. ost_ccy 17. country $50. iso $3. client $100.               &lt;BR /&gt;
           k_client $12. client_t $1. inn $char12. reg $char30. isin $char20. cb $char30.;                                              &lt;BR /&gt;
  input account  ss_naim  var1-var5  ss_ostd  ss_ostc ost_ccy country  iso  client                                                      &lt;BR /&gt;
           k_client client_t  inn  reg isin  cb ;                                                                                       &lt;BR /&gt;
  run;                                                                                                                                  &lt;BR /&gt;
  %end;                                                                                                                                 &lt;BR /&gt;
  %let rc=%sysfunc(dclose(&amp;amp;did));                                                                                                       &lt;BR /&gt;
  %end;                                                                                                                                 &lt;BR /&gt;
  %mend cfin;                                                                                                                           &lt;BR /&gt;
                                                                                                                                        &lt;BR /&gt;
  %cfin;                                                                                                                                &lt;BR /&gt;
                                                                                                                                        &lt;BR /&gt;
                                                                                                                                        &lt;BR /&gt;
  [/pre]</description>
      <pubDate>Fri, 23 Jul 2010 10:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54765#M15194</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2010-07-23T10:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:Text Files importing at once from a folder to  SAS Datasets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54766#M15195</link>
      <description>First Thanks to OLeg_1976 for giving me good answer it has resolved 50% of my query &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
But i have some more to do.&lt;BR /&gt;
&lt;BR /&gt;
In this folder daily new text file is joining and i want to create this to a dataset and append all the datasets to Final dataset. AS new Text file comes it should be created and Append to the Final Dataset .&lt;BR /&gt;
&lt;BR /&gt;
2 Que: How can i know that the New Dataset was Created as New Text file came and how can i know the name of that particular dataset name?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Fri, 23 Jul 2010 11:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54766#M15195</guid>
      <dc:creator>sas_</dc:creator>
      <dc:date>2010-07-23T11:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:Text Files importing at once from a folder to  SAS Datasets.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54767#M15196</link>
      <description>The possible solution is to check date and time of creation of the text files and then read these files to SAS dataset.&lt;BR /&gt;
&lt;BR /&gt;
The code below is reading file attributes (date and time) to sas dataset.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
 %let input=d:\dep\input\2010;&lt;BR /&gt;
 %let dir=%str(%'dir %")&amp;amp;input.%str(\%" /A-D/-C/ON/TW/4 %');&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 filename myfiles pipe %unquote(&amp;amp;dir);&lt;BR /&gt;
 data list1 (compress=no);&lt;BR /&gt;
 infile myfiles truncover ;&lt;BR /&gt;
 informat date ddmmyy10. time1 $5. bytes 8. name $100. ;&lt;BR /&gt;
 input date ?? @1 @; if not missing(date) then do;&lt;BR /&gt;
 input  time1 13-17  bytes  19-35  name @37;&lt;BR /&gt;
 end; else delete;&lt;BR /&gt;
 time=input(time1,time5.);&lt;BR /&gt;
 format date ddmmyy10. time hhmm.; drop time1;&lt;BR /&gt;
 run;&lt;BR /&gt;
 filename myfiles clear;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 23 Jul 2010 11:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Text-Files-importing-at-once-from-a-folder-to-SAS-Datasets/m-p/54767#M15196</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2010-07-23T11:38:28Z</dc:date>
    </item>
  </channel>
</rss>

