<?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: Proc Sort - Help! in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226588#M54060</link>
    <description>&lt;A href="http://www.ats.ucla.edu/stat/sas/modules/default.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/modules/default.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;1) Proc Sort data=have; by year; run;&lt;BR /&gt;2) You would have to specify more clearly what you want - what does your input look like and what output do you expect?&lt;BR /&gt;3) Create a new variable using Substring() function and then use a PROC FREQ to summarize your data.</description>
    <pubDate>Mon, 21 Sep 2015 16:21:12 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-09-21T16:21:12Z</dc:date>
    <item>
      <title>Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226486#M54044</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do some research with a professor and I've been tasked with learning SAS. I'm trying to use the proc sort command to sort some of the data and would like some help doing this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Sorting data between years, i.e. from 1985-2005&lt;/P&gt;&lt;P&gt;2) Sorting data so it filters out/eliminates data with a certain character in the first slot of a cell. I.e., for SIC codes, I want to filter out any that start with 6 (6123, 6149, etc)&lt;/P&gt;&lt;P&gt;3) I want to add a column that shows how many firms are in a SIC 1-digit code. For example, I want to count the firms that start with 5 (5124, 5655), then sort them by Year. So an example would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) A 5100 2&lt;/P&gt;&lt;P&gt;2) B 5101 2&lt;/P&gt;&lt;P&gt;3) C 4231 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you! If anyone can help me find some beginner tutorials/videos too, that would be great.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 03:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226486#M54044</guid>
      <dc:creator>woodland</dc:creator>
      <dc:date>2015-09-21T03:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226495#M54045</link>
      <description>&lt;P&gt;As you&amp;nbsp;suggest yourself, as a beginner, you need some training.&lt;/P&gt;&lt;P&gt;If you don't have the possibility to attend a physical training location, there are e-learning options. You can start with the free tutorials, and see what that brings you:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/training/tutorial/index.html" target="_blank"&gt;https://support.sas.com/training/tutorial/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There are probably a lot of stuff on youtube as well.&lt;/P&gt;&lt;P&gt;If you find SAS documentation hard to navigate, try to read SAS literature, like The Little SAS Book, or SAS for Dummies:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/publishing/index.html" target="_blank"&gt;https://support.sas.com/publishing/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc Sort does what the name implies, sorts data, and not much more.&lt;/P&gt;&lt;P&gt;You can filter data there using the almost global WHERE statement.&lt;/P&gt;&lt;P&gt;For manipulating&amp;nbsp;data you could use the Data Step, or SQL.&lt;/P&gt;&lt;P&gt;For doing&amp;nbsp;statistical summaries, use (again) SQL, or some other SAS Procedures (Summary, Tabulate, Report).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 07:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226495#M54045</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-09-21T07:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226588#M54060</link>
      <description>&lt;A href="http://www.ats.ucla.edu/stat/sas/modules/default.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/modules/default.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;1) Proc Sort data=have; by year; run;&lt;BR /&gt;2) You would have to specify more clearly what you want - what does your input look like and what output do you expect?&lt;BR /&gt;3) Create a new variable using Substring() function and then use a PROC FREQ to summarize your data.</description>
      <pubDate>Mon, 21 Sep 2015 16:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226588#M54060</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-21T16:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226663#M54074</link>
      <description>&lt;P&gt;PROC FREQ, one of the basic summarization procedures, will by default generate output in order, numeric or alphabetic and the data does not need to be sorted first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc freq data= have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; tables year*siccode/ list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will generate a single output table with year first and then the SIC codes. You can add a where clause to filter data without sorting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where substr(siccode,1,1) = '5'; /*if the sic code is character, which it really should be unless you are doing arithmetic with it*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where floor(siccode/1000) = 5; /* if numeric*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; tables year*siccode/ list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 21:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226663#M54074</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-21T21:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226678#M54076</link>
      <description>&lt;P&gt;1) So it would only show the data from 1985-2005, for this, would I use proc sort or would I use data conditional;? For this, I've posted what I've figured out so far below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data conditional;&lt;/P&gt;&lt;P&gt;if fyear GT 1985 and fyear LT 2005 then;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this might not be correct, but could someone nudge me in the right direction? I don't want it to be an if statement, I just don't know how to filter so it ONLY shows between 1985 and 2005.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) One column of data is SIC codes, so...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;6127&lt;/P&gt;&lt;P&gt;6843&lt;/P&gt;&lt;P&gt;6921&lt;/P&gt;&lt;P&gt;7043&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to eliminate any observations that begin with a "6" (as they're more complicated) so after running my sort or filter, it would only show the "7043" data row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 03:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226678#M54076</guid>
      <dc:creator>woodland</dc:creator>
      <dc:date>2015-09-22T03:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226679#M54077</link>
      <description>&lt;P&gt;Thank you so much! Modified your tables year*sic/list code and got my sort from 1985-2005. If I wanted to add more of my data columns to that table, would I just add them like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fyear*sic*datafamount*etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like that?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 03:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226679#M54077</guid>
      <dc:creator>woodland</dc:creator>
      <dc:date>2015-09-22T03:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sort - Help!</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226753#M54094</link>
      <description>&lt;P&gt;Yes adding the additional variables with the * says to show the combinations in the data. Note that if a variable has missing data then that does not appear in the output unless you include an instruction MISSING in the option list after the / separator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also if you have many levels for each variable you might exceed the display output or it will take a long time to produce. If you have 5 variables with 20 levels each you are asking for 3,200,000 rows of output. So be careful. I have seen an errant Proc freq table output generate more than 5 stack feet of not-quite-as-intended output from a line printer.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 15:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sort-Help/m-p/226753#M54094</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-22T15:22:01Z</dc:date>
    </item>
  </channel>
</rss>

