<?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 Per observation text file export in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109485#M10007</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm hoping someone can help me out.&amp;nbsp; I need to export a single variable from each observation into it's own unique text file whose filename is comprised of 2 variables. My data is a bunch of character variables like the one below.&amp;nbsp; I've simplified it a lot.&amp;nbsp; In my real dataset, the paragraph variable is actually a bunch of text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input id $ paragraph $ group $;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;1 cA1 A&lt;/P&gt;&lt;P&gt;2 cA2 A&lt;/P&gt;&lt;P&gt;3 cA3 A&lt;/P&gt;&lt;P&gt;1 cB1 B&lt;/P&gt;&lt;P&gt;2 cB2 B&lt;/P&gt;&lt;P&gt;3 cB3 B&lt;/P&gt;&lt;P&gt;1 cC1 C&lt;/P&gt;&lt;P&gt;2 cC2 C&lt;/P&gt;&lt;P&gt;3 cC3 C&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;The combination of the variables ID and GROUP are unique.&amp;nbsp; I'd like this to be the resulting text filename.&amp;nbsp; The content of each file is the paragraph variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above dataset, I should end up with 9 files (A1.txt with content cA1, A2.txt with content cA2, etc...).&amp;nbsp; (Whether or not the file ends in .txt does not matter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm on WinXP and was playing with something like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename cc 'J:\SAS_PROGRAMS\STATISTICS FRAMEWORK\projects\Camper Satisfaction Sentiment Analysis\_test\name';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_; set have;&lt;/P&gt;&lt;P&gt;length fname $250;&lt;/P&gt;&lt;P&gt;fname = "J:\SAS_PROGRAMS\STATISTICS FRAMEWORK\projects\Camper Satisfaction Sentiment Analysis\_test\" || TRIM(fname);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fname = id || group;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file cc filevar=fname;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put comment;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Removing the filevar option will make this write all obs to "name" text file.&amp;nbsp; The filevar= option seems to do what I want BUT my computer is locked down and I can't write to the default path.&amp;nbsp; I get this error: "Insufficient authorization to access C:\Program Files\SASHome\SASFoundation\9.3\1" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is there a way to change the path of where the file is stored when using the filevar option? (X command using chdir doesn't seem to work)&lt;/LI&gt;&lt;LI&gt;Alternatively, is there a different approach?&amp;nbsp; A DO-loop and text-file-writing-macro ?&amp;nbsp; My data is about 6,000 observation so I am sort of concerned about performance (which is likely more an issue of writing that many files to a single Windows directory...)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I also just noticed that fname seems to have some blank spaces...)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Aug 2013 15:39:36 GMT</pubDate>
    <dc:creator>jaredp</dc:creator>
    <dc:date>2013-08-13T15:39:36Z</dc:date>
    <item>
      <title>Per observation text file export</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109485#M10007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm hoping someone can help me out.&amp;nbsp; I need to export a single variable from each observation into it's own unique text file whose filename is comprised of 2 variables. My data is a bunch of character variables like the one below.&amp;nbsp; I've simplified it a lot.&amp;nbsp; In my real dataset, the paragraph variable is actually a bunch of text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input id $ paragraph $ group $;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;1 cA1 A&lt;/P&gt;&lt;P&gt;2 cA2 A&lt;/P&gt;&lt;P&gt;3 cA3 A&lt;/P&gt;&lt;P&gt;1 cB1 B&lt;/P&gt;&lt;P&gt;2 cB2 B&lt;/P&gt;&lt;P&gt;3 cB3 B&lt;/P&gt;&lt;P&gt;1 cC1 C&lt;/P&gt;&lt;P&gt;2 cC2 C&lt;/P&gt;&lt;P&gt;3 cC3 C&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;The combination of the variables ID and GROUP are unique.&amp;nbsp; I'd like this to be the resulting text filename.&amp;nbsp; The content of each file is the paragraph variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above dataset, I should end up with 9 files (A1.txt with content cA1, A2.txt with content cA2, etc...).&amp;nbsp; (Whether or not the file ends in .txt does not matter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm on WinXP and was playing with something like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename cc 'J:\SAS_PROGRAMS\STATISTICS FRAMEWORK\projects\Camper Satisfaction Sentiment Analysis\_test\name';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_; set have;&lt;/P&gt;&lt;P&gt;length fname $250;&lt;/P&gt;&lt;P&gt;fname = "J:\SAS_PROGRAMS\STATISTICS FRAMEWORK\projects\Camper Satisfaction Sentiment Analysis\_test\" || TRIM(fname);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fname = id || group;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file cc filevar=fname;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put comment;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Removing the filevar option will make this write all obs to "name" text file.&amp;nbsp; The filevar= option seems to do what I want BUT my computer is locked down and I can't write to the default path.&amp;nbsp; I get this error: "Insufficient authorization to access C:\Program Files\SASHome\SASFoundation\9.3\1" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is there a way to change the path of where the file is stored when using the filevar option? (X command using chdir doesn't seem to work)&lt;/LI&gt;&lt;LI&gt;Alternatively, is there a different approach?&amp;nbsp; A DO-loop and text-file-writing-macro ?&amp;nbsp; My data is about 6,000 observation so I am sort of concerned about performance (which is likely more an issue of writing that many files to a single Windows directory...)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I also just noticed that fname seems to have some blank spaces...)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:39:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109485#M10007</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-08-13T15:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Per observation text file export</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109486#M10008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, my put statement should read "put paragraph"....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109486#M10008</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-08-13T15:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Per observation text file export</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109487#M10009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ordering matters. The value of fname when file cc filevar=fname occurs is A1 B2 etc. and not a full path extension which is required by the filevar= option as specificed in SAS documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A name="a000699156"&gt;&lt;/A&gt;&lt;A name="a000852737"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;FILEVAR=&lt;SPAN class="strong"&gt;variable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A name="a000852738"&gt;&lt;/A&gt;defines a variable whose change in value causes the &lt;BR /&gt;FILE statement to close the current output file and open a new one the next time &lt;BR /&gt;the FILE statement executes. The next PUT statement that executes writes to the &lt;BR /&gt;new file that is specified as the value of the FILEVAR= variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY&gt;&lt;TR valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" width="95"&gt;Restriction:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight"&gt;&lt;A name="a000852739"&gt;&lt;/A&gt;The value of a FILEVAR= &lt;BR /&gt;variable is expressed as a character string that contains a physical filename.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example that should solve your issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let path=J:\SAS_PROGRAMS\STATISTICS FRAMEWORK\projects\Camper Satisfaction Sentiment Analysis\_test\;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fname="&amp;amp;path"||trim(group)||trim(id)||".txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file cc filevar=fname;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put paragraph;&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;Vince&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 16:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109487#M10009</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2013-08-13T16:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Per observation text file export</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109488#M10010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much.&amp;nbsp; That did the trick! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was originally trying to work with a Do loop and macro, but then came across the Filevar option.&amp;nbsp; For some reason, I couldn't quite understand if filevar required a path or just the file name.&amp;nbsp; Thanks for clarifying it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jared&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 16:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Per-observation-text-file-export/m-p/109488#M10010</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-08-13T16:24:19Z</dc:date>
    </item>
  </channel>
</rss>

