<?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: How to print select data from dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51341#M14101</link>
    <description>data smith;&lt;BR /&gt;
set all_files;&lt;BR /&gt;
file '/directory/smith.txt' PRINT;&lt;BR /&gt;
where username='smith''&lt;BR /&gt;
put smith /directory/smith.txt; - (told to use - put username path filename)&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
for information:  smith=username&lt;BR /&gt;
                       path= /directory/smith.txt&lt;BR /&gt;
                       filename= smith.txt&lt;BR /&gt;
&lt;BR /&gt;
When doing this it creates the filename smith.txt but writes smith /directory/smith.txt inside of the file.</description>
    <pubDate>Fri, 16 Jul 2010 16:50:43 GMT</pubDate>
    <dc:creator>tes218</dc:creator>
    <dc:date>2010-07-16T16:50:43Z</dc:date>
    <item>
      <title>How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51338#M14098</link>
      <description>Hi, New to SAS.  I need to write select records based on a username from a dataset to a text file. &lt;BR /&gt;
&lt;BR /&gt;
What would be the way?&lt;BR /&gt;
&lt;BR /&gt;
I have the sorted dataset - sorted by username.  Need to write records corresponding to the username to a file.&lt;BR /&gt;
&lt;BR /&gt;
Sorted by username&lt;BR /&gt;
&lt;BR /&gt;
Code:&lt;BR /&gt;
&lt;BR /&gt;
Proc sort data=all_files;&lt;BR /&gt;
  by username;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data smith;&lt;BR /&gt;
set all_files;&lt;BR /&gt;
file '/directory/smith.txt' PRINT;&lt;BR /&gt;
where username='smith''&lt;BR /&gt;
&lt;BR /&gt;
Now this is where I get lost. Was told to possibly use the PUT command but can't make it work correctly.  &lt;BR /&gt;
&lt;BR /&gt;
Any help is greatly appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Fri, 16 Jul 2010 15:52:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51338#M14098</guid>
      <dc:creator>tes218</dc:creator>
      <dc:date>2010-07-16T15:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51339#M14099</link>
      <description>If you already have a SAS dataset and you now want a subset dataset you can do this;&lt;BR /&gt;
&lt;BR /&gt;
data smith;&lt;BR /&gt;
set all_files (where=( upcase(username)='SMITH''));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
If you just want to print the subset from the master file:&lt;BR /&gt;
&lt;BR /&gt;
proc print data=all_files (where=(upcase(username)='SMITH'));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
There is no need to sort for the steps shown above</description>
      <pubDate>Fri, 16 Jul 2010 16:19:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51339#M14099</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2010-07-16T16:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51340#M14100</link>
      <description>Yes, a PUT statement - share what code you have that does not work.&lt;BR /&gt;
&lt;BR /&gt;
Also, there's much to offer for code examples and supplemental conference topic papers available at the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website, either using its SEARCH facility or you can use a Google advanced search argument and include the parameter site:sas.com  to limit the search to just the SAS website.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
data step put statement write file site:sas.com</description>
      <pubDate>Fri, 16 Jul 2010 16:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51340#M14100</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-16T16:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51341#M14101</link>
      <description>data smith;&lt;BR /&gt;
set all_files;&lt;BR /&gt;
file '/directory/smith.txt' PRINT;&lt;BR /&gt;
where username='smith''&lt;BR /&gt;
put smith /directory/smith.txt; - (told to use - put username path filename)&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
for information:  smith=username&lt;BR /&gt;
                       path= /directory/smith.txt&lt;BR /&gt;
                       filename= smith.txt&lt;BR /&gt;
&lt;BR /&gt;
When doing this it creates the filename smith.txt but writes smith /directory/smith.txt inside of the file.</description>
      <pubDate>Fri, 16 Jul 2010 16:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51341#M14101</guid>
      <dc:creator>tes218</dc:creator>
      <dc:date>2010-07-16T16:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51342#M14102</link>
      <description>I have the dataset but need to create a text file on a Linux server with just that one user's information in it.</description>
      <pubDate>Fri, 16 Jul 2010 16:53:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51342#M14102</guid>
      <dc:creator>tes218</dc:creator>
      <dc:date>2010-07-16T16:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51343#M14103</link>
      <description>You've got some serious PUT statement syntax issues, related to double- and single-quote marks.  Suggest you paste your SAS log in a forum reply, if you would like some assistance / guidance debugging your SAS program?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 16 Jul 2010 17:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51343#M14103</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-16T17:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51344#M14104</link>
      <description>28&lt;BR /&gt;
29   data smith;&lt;BR /&gt;
30     set sasuser.all_files;&lt;BR /&gt;
31     file '/directory/smith.txt' PRINT;&lt;BR /&gt;
32     where owner='smith';&lt;BR /&gt;
33     put owner '/directory/smith.txt';&lt;BR /&gt;
34   run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The file '/directory/smith.txt' is:&lt;BR /&gt;
      Filename=/directory/smith.txt,&lt;BR /&gt;
      Owner Name=xxxxx,Group Name=xxx,&lt;BR /&gt;
      Access Permission=rw-------,&lt;BR /&gt;
      Last Modified=Fri Jul 16 13:31:19 2010&lt;BR /&gt;
&lt;BR /&gt;
NOTE: 1 record was written to the file '/directory/smith.txt'.&lt;BR /&gt;
      The minimum record length was 31.&lt;BR /&gt;
      The maximum record length was 31.&lt;BR /&gt;
NOTE: There were 1 observations read from the data set SASUSER.ALL_FILES.&lt;BR /&gt;
      WHERE owner='smith';&lt;BR /&gt;
NOTE: The data set WORK.smith has 1 observations and 8 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.09 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
output in file is:   smith   /directory/smith.txt</description>
      <pubDate>Fri, 16 Jul 2010 17:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51344#M14104</guid>
      <dc:creator>tes218</dc:creator>
      <dc:date>2010-07-16T17:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51345#M14105</link>
      <description>Can you explain what the problem is?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 16 Jul 2010 17:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51345#M14105</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-16T17:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51346#M14106</link>
      <description>The problem is with the output.   It is creating the file - smith.txt but the data in the file is wrong.   It is just putting in the words I used in the 'put' command - ie &lt;B&gt;smith /directory/smith.txt &lt;/B&gt; instead of something that should look like this:&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;165 bytes smith 25JUL2009 /directory/testing/filename.txt  &lt;/B&gt;- this is the information in the dataset that has been created.   There are many listed by various users so I need to create a text file containing all of the files that belong to a particular user.</description>
      <pubDate>Fri, 16 Jul 2010 18:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51346#M14106</guid>
      <dc:creator>tes218</dc:creator>
      <dc:date>2010-07-16T18:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51347#M14107</link>
      <description>Sounds like you need to analyze (PROCs CONTENTS, PRINT, FREQ) your input file SASUSER.ALL_FILES and the SAS variables/columns it contains.  Your PUT statement must either list SAS variables, literal text (quoted), and / or PUT statement control commands.  And if you were told what to code, I'd suggest you refer back to that individual for further guidance or at least take some interest in reading some basics about SAS datasets, variables and DATA step programming.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 16 Jul 2010 18:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51347#M14107</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-16T18:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to print select data from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51348#M14108</link>
      <description>this line controls what appears in the output report/text file.&lt;B&gt;&lt;BR /&gt;
&amp;gt; 33     put owner '/directory/smith.txt';&lt;/B&gt;&lt;BR /&gt;
You should replace that with this[pre]   put (_all_)(' ') ;[/pre] This puts all variables of sasuser.all_files into the output.&lt;BR /&gt;
To print just your chosen list of data columns, replace (_all_)(' ')  with that list .&lt;BR /&gt;
 &lt;BR /&gt;
good luck</description>
      <pubDate>Mon, 19 Jul 2010 13:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-select-data-from-dataset/m-p/51348#M14108</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-07-19T13:16:38Z</dc:date>
    </item>
  </channel>
</rss>

