<?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: Sorting data, numerous times- How would you try this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332840#M74956</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: You may be right! Conversely, I've encountered many employed folks, over the years, who needed some help solving a problem of this complexity. On the other hand, knowing where to go and what to ask (and, as a result, being able to solve a problem), isn't a bad skill in itself &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 23:52:31 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-02-14T23:52:31Z</dc:date>
    <item>
      <title>Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332459#M74833</link>
      <description>&lt;P&gt;Ok, i have to create a .csv file that will list incomes for women in list format from 10-20k, 20k-30k and so on until 100k or more. It is in two columns, one is full time and the other is part time. Their wages are random entries in the cells. How would you incorporate this design? Or better yet how would you write out the code for this project?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Release: 3.5 (Enterprise Edition)&lt;/STRONG&gt;&lt;/SPAN&gt; of SAS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="assignmentslevel2"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Write&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="apple-converted-space"&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;a SAS®&lt;SPAN class="apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;program to access the Microsoft®Excel®spreadsheet and select the approximately 20 observations for the total population estimate of females that worked full-time and year-round.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="assignmentslevel2"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Create&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; a variable that contains the maximum earning in the Microsoft®&lt;SPAN class="apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;Excel®&lt;SPAN class="apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;spreadsheet Column A labels. As an example, for label $2,500 to $4,999, the variable would include value 4,999. This is in addition to the variable that contains the associated population number.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="assignmentslevel2"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Store&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; this data in a raw data file. Sort the data from highest amount earned to lowest amount earned. Store this sorted data in a second raw data file. Perform another sort to order the data from highest population number to lowest population number. Store this sorted data in a third raw data file. Keep the two related data variables associated so that after each sort the amount earned is associated with the population number or the number of people that earned that amount.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 03:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332459#M74833</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-14T03:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332461#M74835</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/128957"&gt;@SixUnder&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp; How would you incorporate this design? Or better yet how would you write out the code for this project?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How much credit for this homework?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 03:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332461#M74835</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-14T03:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332462#M74836</link>
      <description>&lt;P&gt;I asked for approaches, not the answers. As in pseudocode, or a layout. Perhaps my lingo is not as special as the rest of people who work with SAS everyday, I could of written in different. I am trying to understand and the learn the concepts, and the syntax in a short time frame. Please no trolling.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 03:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332462#M74836</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-14T03:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332464#M74838</link>
      <description>&lt;P&gt;I appreciate your earnestness.&amp;nbsp; What strategies have you contemplated?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 03:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332464#M74838</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-14T03:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332472#M74840</link>
      <description>&lt;P&gt;Of course, I am very new to SAS, so the basic principles of it are still not my forteit. I want to lay this our like any other language but this problem seems complex to me. I understand the basic of course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data step&lt;/P&gt;&lt;P&gt;input step&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;possible options&lt;/P&gt;&lt;P&gt;library admin&lt;/P&gt;&lt;P&gt;data sorting for display- one set of values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then of course&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This question is asking for so much, and i cant translate it into the steps one at a time for the program, at least not in my head.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. create a variable that contains the max earning for column A&lt;/P&gt;&lt;P&gt;(it adds this curveball in there, &lt;SPAN&gt;As an example, for label $2,500 to $4,999, the variable would include value 4,999. This is in addition to the variable that contains the associated population number)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. store data in a raw file, does this mean in the program? or in another .csv file?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. sort the data from highest earned to lowest money earned&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4. perform a additional sort for highest to lowest population&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;5. store this in a 3rd raw data file(again no clue there)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;6. keep the two data variables associated( it only asked for one) so after each sort the amount earned matched the poplulation number.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I guess those are my steps, at least once i create and upload a .csv file, i just dont know what im doing, or im in over my head.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 04:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332472#M74840</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-14T04:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332473#M74841</link>
      <description>&lt;P&gt;Proc sort for sorting. You can use an OUT dataset to keep a unique copy though it seems weird.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc sort data=SASHELP.class out=class_age;&lt;/P&gt;
&lt;P&gt;by age;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Honestly without seeing the data I'm not sure we understand all the requirements. Rather than tackle all the requirements, start the first one and then move on from there. If you can get your pseudocode, then here has examples on many of the common tasks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/training/tutorial/" target="_blank"&gt;http://support.sas.com/training/tutorial/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I'm not sure I'd call the comments trolling. You literally copied and pasted your question into a forum and asked 'how would you write out the code'. That isn't a request for methods or pseudocode in my book either.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 04:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332473#M74841</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-14T04:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332482#M74846</link>
      <description>I think that the instructions is as close to pseudo code it can get, all step are described there. &lt;BR /&gt;So what's missing is basic SAS programming skills which your training should serve you...But if that isn't enough for you take the free online Programming 1 course.</description>
      <pubDate>Tue, 14 Feb 2017 05:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332482#M74846</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-02-14T05:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332697#M74916</link>
      <description>&lt;P&gt;A certain amout of ordering can be done within procedure output for reports so "sorting" may not be needed.&lt;/P&gt;
&lt;P&gt;Also Formats are a very good way to associate specific values of a variable with a display category so keeping a category with a value is trivial.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wouldn't even worry about "sorting" until I knew what the desired result looked like. The "sort" instructions look like something I might expect from a spreadsheet user who is used to having to physically reorder data at each step of process. Attempting to duplicate the entire process step-by-step of a spreadsheet process often leads to extremely convoluted and hard to maintain SAS code.&lt;/P&gt;
&lt;P&gt;Consider: ( you should have the sashelp.class data set available)&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex/ order=freq;
   class age/order=data;
   var height;
   tables sex*age,
          n height*(min max mean);
run;

proc tabulate data=sashelp.class;
   class sex/ order=formatted;
   class age/order=freq;
   var height;
   tables sex*age,
          n height*(min max mean);
run;&lt;/PRE&gt;
&lt;P&gt;Results in different output order for the two tables WITHOUT actually "sorting" the data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formats can control appearance order, order of appearance in a data set, frequency of a value, the actual value and for some procedures you may get other options.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 16:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332697#M74916</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-14T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332819#M74950</link>
      <description>&lt;P&gt;here is the data in a comma delimited format. Just so everyone can see what I am working with.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 22:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332819#M74950</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-14T22:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332822#M74952</link>
      <description>&lt;P&gt;Having seen your data, here's the pseudo code and the pointers to the relevant SAS way to do it. I'm not writing code. This assumes you've already imported the data into SAS in the first place successfully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="assignmentslevel2"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Write&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="apple-converted-space"&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;a SAS®&lt;SPAN class="apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;program to access the Microsoft®Excel®spreadsheet and select the approximately 20 observations for the total population estimate of females that worked full-time and year-round.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="assignmentslevel2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;1. Filter the data for only the variable of interest since your data has multiple measurements in the same column. This would be a WHERE or IF/THEN statement in a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P class="assignmentslevel2"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Create&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; a variable that contains the maximum earning in the Microsoft®&lt;SPAN class="apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;Excel®&lt;SPAN class="apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;spreadsheet Column A labels. As an example, for label $2,500 to $4,999, the variable would include value 4,999. This is in addition to the variable that contains the associated population number.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="assignmentslevel2"&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Recode the variable so that you have a numeric value instead of the value 5000- 7499. This is likely so you can sort it properly since text sorts alphabetically. &amp;nbsp;You can accomplish this with an IF/THEN statement, ideally in the same data step as the step above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P class="assignmentslevel2"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Store&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; this data in a raw data file. Sort the data from highest amount earned to lowest amount earned. Store this sorted data in a second raw data file. Perform another sort to order the data from highest population number to lowest population number. Store this sorted data in a third raw data file. Keep the two related data variables associated so that after each sort the amount earned is associated with the population number or the number of people that earned that amount.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These are the proc sorts I initially mentioned in my first answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to accomplish step 1/2 are also in the first link I posted with the YouTube videos.&lt;/P&gt;
&lt;P&gt;Good Luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 22:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332822#M74952</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-14T22:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332838#M74954</link>
      <description>&lt;P&gt;While it at first sounds like a homework assignment, it is more difficult than any homework assignment I've seen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how I would create the initial dataset. Your on your own, from there, determining how to answer the rest of the questions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile="c:\art\data.csv" out=datain replace dbms=csv;
  getnames=no;
  datarow=4;
  guessingrows=32767;
run;

data need (drop=var2 var3);
  set datain (rename=(var1=geo_id));
  if substr(var2,1,89)='Estimate; Female: - Worked full-time, year-round in the past 12 months: - With income: -';
  if substr(reverse(strip(var2)),1,7) eq 'erom ro' then salary=100000;
  else if substr(reverse(strip(var2)),1,7) eq 'ssol ro' then salary=2499;
  else salary=input(substr(var2,index(var2,'to ')+4),comma8.);
  count=input(var3,8.);
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 23:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332838#M74954</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-14T23:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332839#M74955</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;While it at first sounds like a homework assignment, it is more difficult than any homework assignment I've seen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not for a programming or analysis course. This should be expected as base level for any entry level analyst. It covers the base requirements IMO, so another option is, it could be an 'homework' task for a hiring process. All analysts here get hired after completing a programming task. In the last one, the person who got hired passed the first step...the rest couldn't read in the data properly &lt;img id="womanfrustrated" class="emoticon emoticon-womanfrustrated" src="https://communities.sas.com/i/smilies/16x16_woman-frustrated.png" alt="Woman Frustrated" title="Woman Frustrated" /&gt;&amp;nbsp;We don't dictate the language though, because its the process of problem solving that's more important than specifics.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Import a data set&lt;/P&gt;
&lt;P&gt;2. Create new variables&lt;/P&gt;
&lt;P&gt;3. Produce a list report&lt;/P&gt;
&lt;P&gt;4. Produce a summary report (ie proc freq/means)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 23:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332839#M74955</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-14T23:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332840#M74956</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: You may be right! Conversely, I've encountered many employed folks, over the years, who needed some help solving a problem of this complexity. On the other hand, knowing where to go and what to ask (and, as a result, being able to solve a problem), isn't a bad skill in itself &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 23:52:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332840#M74956</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-14T23:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332841#M74957</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;True. I think the ability to program is almost expected from a University graduate these days now.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 00:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/332841#M74957</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-15T00:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/333678#M75238</link>
      <description>&lt;P&gt;I am going to try and create the data step, the input and possibly the variables and go from there. I will come back here and post once i get that far. Whos knows, you are all much more advanced than I am.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 05:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/333678#M75238</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-17T05:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334223#M75472</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc import datafile="c:/data.csv" out=datain replace dbms=csv;
  getnames=no;
  datarow=4;
  guessingrows=40;
run;

data need (drop=var2 var3);
  set datain (rename=(var1=geo_id));
  if substr(var2,1,89)='Estimate; Female: - Worked full-time, year-round in the past 12 months: - With income: -';
  if substr(reverse(strip(var2)),1,7) eq 'erom ro' then salary=100000;
  else if substr(reverse(strip(var2)),1,7) eq 'ssol ro' then salary=2499;
  else salary=input(substr(var2,index(var2,'to ')+4),comma8.);
  count=input(var3,8.);
run;

proc report data = datfile.dat NOWINDOWS HEADLINE;
    title 'Auglaize County sorted Data';
    column Wages Full time Part time Population;
run;

LIBNAME datafile "c file location";

proc report data = datafile.dat NOWINDOWS;
    title 'Auglaize County sorted Data';
run;

PROC SORT DATA=auto OUT=auto2 ;
  BY foreign ;
RUN ;
 
PROC PRINT DATA=auto2 ;
RUN ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/128957"&gt;@SixUnder&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;I am going to try and create the data step, the input and possibly the variables and go from there. I will come back here and post once i get that far. Whos knows, you are all much more advanced than I am.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;close as i have been so far..&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 21:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334223#M75472</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-19T21:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334225#M75473</link>
      <description>&lt;P&gt;I think your program looks pretty straightforward and clean.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One comment - on the use of the REVERSE function, which you are using to get substrings on the right-hand side of some text. You can take advantage of the LENGTH function instead, which will make their intention more apparent:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I.e. instead of&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;if=substr(reverse(strip(var2)),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;) eq &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;'erom ro'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;100000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; else&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; substr(reverse(strip(var2)),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;) eq &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;'ssol ro'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;2499&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; else&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=input(substr(var2,index(var2,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;'to '&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;)+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;comma8.&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; substr(salary,length(salary)-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;)='or more'&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;100000&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; else&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; substr(salary,length(salary)-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;)='or less'&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;2499&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; else&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=input(substr(var2,index(var2,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;'to '&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;)+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;comma8.&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the third line can be changed to:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; else&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; salary=input(scan(vars,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;),&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;comma8.&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;which uses the SCAN function to retrieve the 3rd word of VAR2. No&amp;nbsp; need to find the letters "to" and then add 4.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 21:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334225#M75473</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-19T21:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334227#M75474</link>
      <description>&lt;P&gt;Yes, you're quite close, but your code has some likely errors. e.g.,&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;report&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; datfile&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;dat NOWINDOWS HEADLINE&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will be specifying the SAS dataset set that you created. Thus it should be more like:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;report&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; need NOWINDOWS HEADLINE&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Same thing for your other proc report. And, in your proc sort, where did data 'auto' come from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, you mentioned that your specs called for you to build a report based on a sample of 20 records. That can be accomplished with a datastep like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data subset;
 SampleSize = 20;
 Left = numberObs;
 do i = 1 to numberObs;
    set need point = i nobs = numberObs;
    if uniform(0) le SampleSize/Left then
    do;  /* select the observations */
       SampleSize + (-1); /* decrement needed by 1 */
       output;
    end; /* select the observations */
    Left +(-1); /* decrement remaining obs by 1 */
 end;
 stop;
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 22:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334227#M75474</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-19T22:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334237#M75477</link>
      <description>&lt;P&gt;What do you think of this? Any advise would be appreciated. Thanks. So sad on my part, i still have 3 more of these to do in the next month&lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://communities.sas.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data subset;
 SampleSize = 20;
 Left = numberObs;
 do i = 1 to numberObs;
    set need point = i nobs = numberObs;
    if uniform(0) le SampleSize/Left then
    do;  /* select the observations */
       SampleSize + (-1); /* decrement needed by 1 */
       output;
    end; /* select the observations */
    Left +(-1); /* decrement remaining obs by 1 */
 end;
 stop;
run;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Identify SAS Library folder?&lt;BR /&gt;LIBNAME wk3 '&amp;lt;path&amp;gt;'?&lt;BR /&gt;*Import xls file to an SAS Dataset?&lt;BR /&gt;PROC IMPORT DATAFILE='&amp;lt;path&amp;gt;/&amp;lt;file&amp;gt;.xls' DBMS= XLS OUT=wk3.MedPop1 REPLACE?&lt;BR /&gt;RUN?&lt;BR /&gt;/*Create a dataset based off the original xls, but limit the data to the Female/ Full Time Population */&lt;BR /&gt;Data MedFem?&lt;BR /&gt;SET MedPop1 ?&lt;BR /&gt;Where Sex = 'F' AND Status ='FT'?&lt;BR /&gt;RUN?&lt;BR /&gt;/*Creates a raw 'txt' file to hold the data */&lt;BR /&gt;DATA _NULL_?&lt;BR /&gt;SET MedFem?&lt;BR /&gt;FILE '&amp;lt;path&amp;gt;/&amp;lt;file&amp;gt;.txt' PRINT?&lt;BR /&gt;PUT SEX $ POPULATION Salary_Low Salary_High?&lt;BR /&gt;RUN?&lt;BR /&gt;/* Sorts the data by Salary_High in descending order (highest to lowest salary */&lt;BR /&gt;PROC SORT data = MedFem?&lt;BR /&gt;BY DESCENDING Salary_High?&lt;BR /&gt;RUN?&lt;BR /&gt;/*Creates a raw 'txt' file to hold the data */&lt;BR /&gt;DATA _NULL_?&lt;BR /&gt;SET MedFem?&lt;BR /&gt;FILE '&amp;lt;path&amp;gt;/&amp;lt;file&amp;gt;.txt' PRINT?&lt;BR /&gt;PUT SEX $ POPULATION Salary_Low Salary_High?&lt;BR /&gt;RUN?&lt;BR /&gt;/* Sorts the data from Highest to lowest population #'s per salary */&lt;BR /&gt;PROC SORT data = MedFem?&lt;BR /&gt;BY DESCENDING Population?&lt;BR /&gt;RUN?&lt;BR /&gt;/*Creates a raw 'txt' file to hold the data */&lt;BR /&gt;DATA _NULL_?&lt;BR /&gt;SET MedFem?&lt;BR /&gt;FILE '&amp;lt;path&amp;gt;/&amp;lt;file&amp;gt;.txt' PRINT?&lt;BR /&gt;PUT SEX $ POPULATION Salary_Low Salary_High?&lt;BR /&gt;RUN?&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 01:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334237#M75477</guid>
      <dc:creator>SixUnder</dc:creator>
      <dc:date>2017-02-20T01:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting data, numerous times- How would you try this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334488#M75537</link>
      <description>&lt;P&gt;&amp;nbsp;A couple of notes on the program as you have constructed it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You could put the "set ... point="&amp;nbsp; INSIDE the inner do group.&amp;nbsp; No need to&amp;nbsp;read the data if the record is not going to be kept.&lt;/LI&gt;
&lt;LI&gt;You don't always need the outer loop to go from 1 all the way to numberOBS.&amp;nbsp; Once samplesize reaches zero you can stop the loop. So you could try&amp;nbsp; "do i=1 to numberobs while(sampsize&amp;gt;0);"&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 20 Feb 2017 22:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sorting-data-numerous-times-How-would-you-try-this/m-p/334488#M75537</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-20T22:23:38Z</dc:date>
    </item>
  </channel>
</rss>

