<?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: splitting dataset into multiple txt files with tittle variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586021#M167238</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214156"&gt;@RZB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is too much detail in your question for me to try and provide code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you're looking for FILEVAR. This SAS Note is eventually all you need:&amp;nbsp;&lt;A href="http://support.sas.com/kb/24/599.html" target="_blank" rel="noopener"&gt;http://support.sas.com/kb/24/599.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Sep 2019 07:36:13 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-09-04T07:36:13Z</dc:date>
    <item>
      <title>splitting dataset into multiple txt files with tittle variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586020#M167237</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem splitting a data set into multiple txt with title variables and data splitted by differents combinations of variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET final_7;&lt;/P&gt;&lt;P&gt;call symput('HH',trim(left(put(H,Z2.))));&lt;BR /&gt;call symput('MI',trim(left(put(M,Z2.))));&lt;BR /&gt;call symput('SS',trim(left(put(S,Z2.))));&lt;BR /&gt;CALL SYMPUT("FECHAOUT",TRIM(LEFT(put(FECHA,YYMMDD6.))));&lt;BR /&gt;CALL SYMPUT("CCC",CAD);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILE "&amp;amp;OUTPATH.\HK&amp;amp;fechaout.&amp;amp;HH.&amp;amp;MI.&amp;amp;SS.&amp;amp;CCC..TXT";&lt;BR /&gt;HFIN=HORNOT+DURANOT;&lt;BR /&gt;B='09'X;&lt;BR /&gt;IF _N_=1 THEN PUT @1 CADENA Z4. B PROG B HORNOT TIME. B HFIN TIME. B NOTICIA;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET final_7;&lt;/P&gt;&lt;P&gt;call symput('HH',trim(left(put(H,Z2.))));&lt;BR /&gt;call symput('MI',trim(left(put(M,Z2.))));&lt;BR /&gt;call symput('SS',trim(left(put(S,Z2.))));&lt;BR /&gt;CALL SYMPUT("FECHAOUT",TRIM(LEFT(put(FECHA,YYMMDD6.))));&lt;BR /&gt;CALL SYMPUT("CCC",CAD);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FILE "&amp;amp;OUTPATH.\HK&amp;amp;fechaout.&amp;amp;HH.&amp;amp;MI.&amp;amp;SS.&amp;amp;CCC..TXT" MOD;&lt;BR /&gt;B='09'X;&lt;BR /&gt;PUT @1 PATROC B HORPRE TIME. B DURPRE TIME. B MENCIO;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this code writes an&amp;nbsp;HK&amp;amp;fechaout.&amp;amp;HH.&amp;amp;MI.&amp;amp;SS.&amp;amp;CCC..TXT&amp;nbsp; with the variable titles and another one&amp;nbsp; with all data set without titles and without splitting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need differents txt files including in each file the variable names:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CADENA&amp;nbsp; ,PROG , HORNOT , HFIN ,NOTICIA;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the data splitted by&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FECHAOUT , HH, MM, SS ,CCC&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with the data of these variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PATROC&amp;nbsp; HORPRE&amp;nbsp; DURPRE&amp;nbsp; MENCIO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The txt files my be like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HK1908191630090006.txt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where 190919 is fechaout, 16 is HH, 30 is MM,09 is SS,and 0006 is CCC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and data into file may be :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0001 Program 16:30:09 17:27:58&amp;nbsp; &amp;nbsp;football&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Citroën 16:55:35 0:00:04 S&lt;BR /&gt;Citroën 16:55:50 0:00:03 S&lt;BR /&gt;Citroën 16:57:26 0:00:05 S&lt;BR /&gt;Salud 17:25:11 0:00:03 S&lt;BR /&gt;Salud&amp;nbsp; 17:25:18 0:00:03 S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where 0001 is CADENA, Program is PROG ,16:30:09 is HORNOT, 17:27:58 is HFIN and football is NOTICIA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the data from data set citroen is PATROC, 16:55:35 is HORPRE, 0:00:04 is DURPRE and football is MENCIO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 07:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586020#M167237</guid>
      <dc:creator>RZB</dc:creator>
      <dc:date>2019-09-04T07:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: splitting dataset into multiple txt files with tittle variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586021#M167238</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214156"&gt;@RZB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is too much detail in your question for me to try and provide code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you're looking for FILEVAR. This SAS Note is eventually all you need:&amp;nbsp;&lt;A href="http://support.sas.com/kb/24/599.html" target="_blank" rel="noopener"&gt;http://support.sas.com/kb/24/599.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 07:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586021#M167238</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-04T07:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: splitting dataset into multiple txt files with tittle variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586026#M167241</link>
      <description>&lt;P&gt;See this example using sashelp.class as a source and the column sex as a group variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
by sex name;
run;

data _null_;
set class;
by sex;
fname = cats('$HOME/sascommunity/class_',sex,'.txt');
file dummy filevar=fname dlm=',' dsd;
if first.sex then put 'name,age,height,weight';
put name age height weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And these are the resulting files:&lt;/P&gt;
&lt;P&gt;class_F.txt:&lt;/P&gt;
&lt;PRE&gt;name,age,height,weight
Alice,13,56.5,84
Barbara,13,65.3,98
Carol,14,62.8,102.5
Jane,12,59.8,84.5
Janet,15,62.5,112.5
Joyce,11,51.3,50.5
Judy,14,64.3,90
Louise,12,56.3,77
Mary,15,66.5,112
&lt;/PRE&gt;
&lt;P&gt;class_M.txt:&lt;/P&gt;
&lt;PRE&gt;name,age,height,weight
Alfred,14,69,112.5
Henry,14,63.5,102.5
James,12,57.3,83
Jeffrey,13,62.5,84
John,12,59,99.5
Philip,16,72,150
Robert,12,64.8,128
Ronald,15,67,133
Thomas,11,57.5,85
William,15,66.5,112
&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Sep 2019 08:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586026#M167241</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-04T08:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: splitting dataset into multiple txt files with tittle variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586326#M167374</link>
      <description>thanks i still trying</description>
      <pubDate>Thu, 05 Sep 2019 07:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586326#M167374</guid>
      <dc:creator>RZB</dc:creator>
      <dc:date>2019-09-05T07:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: splitting dataset into multiple txt files with tittle variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586335#M167379</link>
      <description>&lt;P&gt;thank you,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; modifying the rutine with others delimiters and another variables, i'm near the final result i need.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 08:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-dataset-into-multiple-txt-files-with-tittle-variables/m-p/586335#M167379</guid>
      <dc:creator>RZB</dc:creator>
      <dc:date>2019-09-05T08:41:55Z</dc:date>
    </item>
  </channel>
</rss>

