<?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: Basic SAS: printing out a table based on last names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493650#M129891</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.a;
name="Joe Zions";
output;
name="Joe Smith";
output;
name="Joe Yuck";
output;
run;

data work.b;
set work.a;
where substr(upcase(scan(name,2," ")),1,1) in ('Z','Y');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 07 Sep 2018 21:11:05 GMT</pubDate>
    <dc:creator>mdavidson</dc:creator>
    <dc:date>2018-09-07T21:11:05Z</dc:date>
    <item>
      <title>Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493640#M129885</link>
      <description>&lt;P&gt;So I have a .sas7bdat file. I have successfully opened it by using lib name and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new ;&lt;BR /&gt;set roster.employee_roster ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I am asked to print a table with only peoples last names that start with Z or Y. Im having trouble figuring this out since the names are stored as full names in one column. any suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493640#M129885</guid>
      <dc:creator>jovane0700</dc:creator>
      <dc:date>2018-09-07T21:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493642#M129886</link>
      <description>&lt;P&gt;If the assignment is to only print records with &lt;STRONG&gt;first names&lt;/STRONG&gt; starting with Z or X, it shouldn't matter if the name is stored as a full name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simply do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class;
   where substr(name, 1, 1)="A";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 20:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493642#M129886</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-07T20:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493645#M129888</link>
      <description>&lt;P&gt;Sorry I rushed to type it. Its asking for &lt;U&gt;LASTNAMES&lt;/U&gt; that start with Z or Y. But I only have the column of &lt;U&gt;FULLNAMES&lt;/U&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493645#M129888</guid>
      <dc:creator>jovane0700</dc:creator>
      <dc:date>2018-09-07T21:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493648#M129890</link>
      <description>1. Split names to isolate last name. See SCAN() and/or SUBSTR()&lt;BR /&gt;2. Use SUBSTR() to find the first character of name from #1&lt;BR /&gt;3. Add an IF statement to filter the records out. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493648#M129890</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-07T21:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493650#M129891</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.a;
name="Joe Zions";
output;
name="Joe Smith";
output;
name="Joe Yuck";
output;
run;

data work.b;
set work.a;
where substr(upcase(scan(name,2," ")),1,1) in ('Z','Y');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493650#M129891</guid>
      <dc:creator>mdavidson</dc:creator>
      <dc:date>2018-09-07T21:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493651#M129892</link>
      <description>&lt;P&gt;Do i put these steps in the data step or the proc step? sorry I'm very new to this&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493651#M129892</guid>
      <dc:creator>jovane0700</dc:creator>
      <dc:date>2018-09-07T21:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493656#M129896</link>
      <description>&lt;P&gt;This is for one column of data. What if I'm working with multiple columns such as a .sas7bdat file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file name:&amp;nbsp;employee_roster.sas7bdat&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 21:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493656#M129896</guid>
      <dc:creator>jovane0700</dc:creator>
      <dc:date>2018-09-07T21:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493680#M129910</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/231375"&gt;@jovane0700&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This is for one column of data. What if I'm working with multiple columns such as a .sas7bdat file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;file name:&amp;nbsp;employee_roster.sas7bdat&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The technique &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16552"&gt;@mdavidson&lt;/a&gt;&amp;nbsp;shows is intended to &lt;STRONG&gt;subset &lt;/STRONG&gt;a data set on the values as specified (under some assumptions you have not addressed such as order of first and last name in the name field and some other obnoxious name related stuff). You would use your data set in the place of the work.a on the set statement in the second data step in the example and the work.b set is the one you would print from. His work.a data set is shown to have &lt;STRONG&gt;something&lt;/STRONG&gt; concrete to demonstrate one approach. If your name field looks different than shown in work.a then you need to provide examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 23:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493680#M129910</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-07T23:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Basic SAS: printing out a table based on last names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493711#M129927</link>
      <description>&lt;P&gt;Here's a good starting point&amp;nbsp; It assumes (as you originally stated) that the full name is stored in a single variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=roster.employee_roster;&lt;/P&gt;
&lt;P&gt;where scan(full_name, -1) in : ("Y", "Z");&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this to work, you absolutely must not remove the colon after IN.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 02:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basic-SAS-printing-out-a-table-based-on-last-names/m-p/493711#M129927</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-09-08T02:23:53Z</dc:date>
    </item>
  </channel>
</rss>

