<?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: summary data from data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120209#M24730</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking for number, cumulative number, percent, cumulative percent and total. I am attaching a link to an example of what the ultimate output from SAS would look like in Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am I have a data table that has many child records per county and I need to summarize these records by county, and then by things like age range, year--all the dimensions that are in the link to the attached sample file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how to summarize a data table though. I can do some things in the Enterprise Guide GUI with Procs, but I don't get everything and it is not as neatly organized as the linked example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on approach, etc. would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.nycourts.gov/surveys/cwcip/metric1-Example.zip"&gt;http://www.nycourts.gov/surveys/cwcip/metric1-Example.zip&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Nov 2012 12:22:40 GMT</pubDate>
    <dc:creator>Paul_NYS</dc:creator>
    <dc:date>2012-11-08T12:22:40Z</dc:date>
    <item>
      <title>summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120205#M24726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am looking for a way to summarize the data in a data set. Is there a way to create another data set that summarizes records in the data set from another? In other words, I have a data set that contains the months it takes to achieve certain events and these are stored as columns, along with a county field and a unique record indicator. I would like to group the times it takes to achieve these events by month groupings (i.e. 0-6, 7-12, 13-18, etc.) and then summarize these by sums, percentages by county.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2012 21:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120205#M24726</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-07T21:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120206#M24727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paul,&amp;nbsp; sounds simple enough but it will help if you provide example have and want datasets, preferably in the form of datasteps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2012 22:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120206#M24727</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-07T22:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120207#M24728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For this, I don't have much of a data step to do it actually. I am not even sure it can be done. The existing data table (s1) has the following columns (among many others, but the below are key):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;entity_id (unique id)&lt;/P&gt;&lt;P&gt;age_category (1-4 indicator of the age range)&lt;/P&gt;&lt;P&gt;county (county)&lt;/P&gt;&lt;P&gt;ExitMonths (the time in months it takes to reach the court milestone)&lt;/P&gt;&lt;P&gt;ExitMonthCategory (either a 6, 12, 18, 24 indicator)&lt;/P&gt;&lt;P&gt;startYear (year child entered the court system)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do is to export a new data set (ultimately to Excel) creating columns for month ranges (i.e. 0-6, 7-12, 13-18, etc.) and rows for summarized measures and dimensions (i.e. county, age range, number, percent, cumulative percent). The row dimensions would summarize the above ExitMonths column from the s1 data table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using Enterprise Guide to run a frequency over the s1 table, but could not get what I want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2012 23:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120207#M24728</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-07T23:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120208#M24729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What type of summary are you looking for, counts, percents, means or something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may want to manually create and post an example of the final output desired appearance. &lt;/P&gt;&lt;P&gt;It may be that Proc Tabulate or Report would work as they allow many summarization options. The output can be set to Excel using ODS TAGSETS.EXCELXP and even result in semi-pretty tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 00:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120208#M24729</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-11-08T00:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120209#M24730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking for number, cumulative number, percent, cumulative percent and total. I am attaching a link to an example of what the ultimate output from SAS would look like in Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I am I have a data table that has many child records per county and I need to summarize these records by county, and then by things like age range, year--all the dimensions that are in the link to the attached sample file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how to summarize a data table though. I can do some things in the Enterprise Guide GUI with Procs, but I don't get everything and it is not as neatly organized as the linked example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on approach, etc. would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.nycourts.gov/surveys/cwcip/metric1-Example.zip"&gt;http://www.nycourts.gov/surveys/cwcip/metric1-Example.zip&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 12:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120209#M24730</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-08T12:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120210#M24731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paul, As I had mentioned, earlier, you will get better responses if you provide an example dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without knowing what your data looks like, all any of us can do is guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your output looks like a result that could easily be obtained using a combination of proc freq and proc transpose.&amp;nbsp; e.g., the following comes close:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value timespan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low-0.084931=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0849310001-0.167123=2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1671230001-0.252054=3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other=4;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat cnty_name $20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat description $30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat start_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format start_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id cnty_name description age_range year start_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; time_in_program=yrdif(start_date, today(), 'AGE');&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 Hopeland Outcome-2940 1 2006 8jan2012&lt;/P&gt;&lt;P&gt;2 Hopeland Outcome-2940 1 2006 8feb2012&lt;/P&gt;&lt;P&gt;3 Hopeland Outcome-2940 2 2006 8aug2012&lt;/P&gt;&lt;P&gt;4 Hopeland Outcome-2940 2 2006 8sep2012&lt;/P&gt;&lt;P&gt;5 Hopeland Outcome-2940 2 2006 8oct2012&lt;/P&gt;&lt;P&gt;1 Nohopeland Outcome-2940 1 2006 8jan2012&lt;/P&gt;&lt;P&gt;2 Nohopeland Outcome-2940 1 2006 8feb2012&lt;/P&gt;&lt;P&gt;3 Nohopeland Outcome-2940 3 2006 8aug2012&lt;/P&gt;&lt;P&gt;4 Nohopeland Outcome-2940 3 2006 8sep2012&lt;/P&gt;&lt;P&gt;5 Nohopeland Outcome-2940 3 2006 8oct2012&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=have noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; tables cnty_name*age_range*time_in_program/out=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format time_in_program timespan.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=test out=want (drop=_label_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename=(_name_=DataElement))prefix=months;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by cnty_name age_range;&lt;/P&gt;&lt;P&gt;&amp;nbsp; idlabel time_in_program;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 15:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120210#M24731</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-08T15:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120211#M24732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur&lt;/P&gt;&lt;P&gt;Two questions among many, but two to start:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. How are you coming up with the month ranges along the top of the spreadsheet? From the code, I am not seeing how this is determined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. The first proc format does what?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 17:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120211#M24732</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-08T17:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120212#M24733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your second question answers your first question.&amp;nbsp; The proc format converts the age calculation into months.&amp;nbsp; I only did it for months 1, 2 and 3, and formatted all other "ages" to be 4, as I didn't know if this approach was what you were looking for or if your data was just dates like those I used as a sample dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I calculated time in program with the statement: &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; time_in_program=yrdif(start_date, today(), 'AGE');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, applied the format when I ran proc freq with the statement: &lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; format time_in_program timespan.;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 17:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120212#M24733</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-08T17:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120213#M24734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My data ranges (at top of the spreadsheet) are just individual months or 6 month groupings. How do they correspond to the below values (i.e. -0.084931)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value timespan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low-0.084931=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0849310001-0.167123=2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1671230001-0.252054=3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other=4;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 19:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120213#M24734</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-08T19:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120214#M24735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depends on your actual desired cutoffs.&amp;nbsp; I was approximating 1/12th of a year.&amp;nbsp; Actually, it should have been 0.08333 for one month, 0.166667 for two months, 0.25 for 3 months, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 19:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120214#M24735</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-08T19:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120215#M24736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. what does 'low' refer to in proc format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. How are you automatically classifying the values in time in program as belonging to one of the month categories?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 22:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120215#M24736</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-11-08T22:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: summary data from data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120216#M24737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paul, Low means the lowest value that SAS can represent (excluding missing values).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You didn't provide any example data, thus I built my example on the premise that you had a start date, which I called start_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then calculated &lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; time_in_program as yrdif(start_date, today(), 'AGE');&amp;nbsp; What that calculated is the difference between start_date and today(), expressed as a real number, similar to how one would calculate someone's age.&amp;nbsp; If the difference was precisely one month, the resulting number would be &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; 0.08333&lt;/SPAN&gt;.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If the difference was precisely one year, the resulting number would be &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1.0&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I created and applied a format to classify those calculations into time groups.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 23:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summary-data-from-data-set/m-p/120216#M24737</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-08T23:22:23Z</dc:date>
    </item>
  </channel>
</rss>

