<?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: data manipulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924405#M363864</link>
    <description>&lt;P&gt;Any format based solution to order pretty much means that you have to provide something that handles all the values.&lt;/P&gt;
&lt;P&gt;Since your example output does not include the "TOTAL" that was in your previous question and adds a value not there it's pretty hard to demonstrate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the PRELOADFMT option with ORDER=DATA on the Define. If you create the format with the NOTSORTED option then the values will display in the Format definition order:&lt;/P&gt;
&lt;P&gt;This uses a different order to show that it forces to a different order than the data set. Since you did not include a specific place for TOTAL I exclude that from Proc Report with the Where since just demonstrating this format and option set. This uses the Test2 data set created in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s example.&lt;/P&gt;
&lt;PRE&gt;proc format;
value $service (notsorted)
'Girl'='Girl'
'Boy' ='Boy'
'Dad' ='Dad'
;
run;
proc report data=test2;
    where serv ne 'TOTAL';
    columns serv table ("Active" active active_pct) ("Reserve" reserve reserve_pct);
    define serv/group "Serv" format=$service. preloadfmt order=data;
    define table/group "Table";
    define active/'N' format=comma10.0;
    define active_pct/'%' format=percent8.2;
    define reserve/'N' format=comma10.0;
    define reserve_pct/'%' format=percent8.2;
run;&lt;/PRE&gt;
&lt;P&gt;To place "Busy Z" in a specific order in your data you would add it to the format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2024 17:34:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-04-15T17:34:27Z</dc:date>
    <item>
      <title>data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924188#M363774</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Please I need some help with data manipulation. I have clean up the data up to this point. Now, I want to create a frequency and percentages for each serv by table. The active and reserve is the count of boy in 2796 table who are active or reserve. i want to find the percentage of these count to create a table below&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;For example: I want the (%) for Boy in PHA(table) who are Active, (%) for Boy in 2796 who are active and so on.&amp;nbsp; Just like my desired table below.&amp;nbsp; I think I need numerator &amp;amp; denominator but am not sure. Am think to get the percentage for Boy in PHA who are active, my numerator is 41043/706476 (total PHA).&amp;nbsp;I don't know how to code this in SAS. Any help is highly appreciated&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ddata test;&lt;BR /&gt;length serv $5 table $5 ;&lt;BR /&gt;infile datalines dlm=',' dsd;&lt;BR /&gt;input serv $ table $ Active Reserve ;&lt;BR /&gt;datalines;&lt;BR /&gt;Boy,2796,41043,7024&lt;BR /&gt;Boy,PHA,274220,95291&lt;BR /&gt;Girl,2796,3200,1231&lt;BR /&gt;Girl,PHA,121634,36043&lt;BR /&gt;Dad,2796,9915,310&lt;BR /&gt;TOTAL,2796,77283,11371&lt;BR /&gt;TOTAL,PHA,706476,195988&lt;BR /&gt;; &lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;desired output&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Serv&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Table&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Active&lt;/P&gt;&lt;/TD&gt;&lt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TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;TOTAL&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;PHA&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;706476&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;195988&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2796&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;77283&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;11371&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 12 Apr 2024 19:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924188#M363774</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-04-12T19:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924197#M363780</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length serv $5 table $5 ;
infile datalines dlm=',' dsd;
input serv $ table $ Active Reserve ;
datalines;
Boy,2796,41043,7024
Boy,PHA,274220,95291
Girl,2796,3200,1231
Girl,PHA,121634,36043
Dad,2796,9915,310
TOTAL,2796,77283,11371
TOTAL,PHA,706476,195988
; 
proc sort data=test;
    by table;
run;
data test2;
    merge test(where=(serv='TOTAL') rename=(active=active_total reserve=reserve_total)) test;
    by table; 
    active_pct=active/active_total;
    reserve_pct=reserve/reserve_total;
run;

proc report data=test2;
    columns serv table ("Active" active active_pct) ("Reserve" reserve reserve_pct);
    define serv/group "Serv";
    define table/group "Table";
    define active/'N' format=comma10.0;
    define active_pct/'%' format=percent8.2;
    define reserve/'N' format=comma10.0;
    define reserve_pct/'%' format=percent8.2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values on the total line do not appear to be the total of the lines above it. So the percents don't add to 100%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, I again urge you (in fact, I insist) that you test your code by actually running it to make sure it works and gives the right answers. In this case, your code produces errors in the log. Please don't make us waste our time running code that doesn't work, or running code where the data is clearly incorrect. We're trying to help you, but you have to help us as well.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 21:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924197#M363780</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-12T21:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924199#M363782</link>
      <description>&lt;P&gt;If you want a percentage you really do need to tell us exactly what the numerator and denominator is.&lt;/P&gt;
&lt;P&gt;I have a suspicion that there may be more data "missing" in some way, even more than the Missing COMP in your other question because total up all of the Boy, Girl and Dad for either 2796 or PHA and the total of those is much less than the number reported for your "total".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that you may have manipulated your data so much getting to this part that lost something in context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do you answer this question: Is either a row, a column or all percentages or all the percentages within a value of Table supposed to sum to 100? If the answer is Yes, then tell us which one and explain where the not represented numerator values would be.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 21:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924199#M363782</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-12T21:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924397#M363861</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Thank you! Thank you! This works however I have one more question. I created a format for service because I want it in alphabetical like but I don't want my results to have 1Boy, 2Dad, 3Girl. How do I remove it or re-format so it does not have it in the final result.&amp;nbsp; In the table below I add more variables so it looks like the original dataset and I wanted it in that exact format.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc format;
 value $service 
'Boy' = '1Boy'
'Dad'= '2Dad'
'Girl' = '3Girl'
;&lt;/CODE&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Component&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Service&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Table&lt;/STRONG&gt;&lt;/P&gt;&lt;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bsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 15 Apr 2024 15:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924397#M363861</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-04-15T15:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924401#M363862</link>
      <description>&lt;P&gt;People do add numbers in front of 'Boy','Dad', &lt;EM&gt;etc&lt;/EM&gt;. and I think this is a very poor practice. The resulting table with '1Boy' looks, in my opinion, unprofessional. Fortunately, it is easy to work around this so that PROC REPORT puts things in whatever order you want. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create a numeric value for Boy, Dad, etc. that represents the desired sequence */
data test3;
    set test2;
    if service='Boy' then seq=1;
    else if service='Dad' then seq=2;
    else if service='Girl' then seq=3;
    else if service='TOTAL'&amp;nbsp;then&amp;nbsp;seq=999;
run;

/* Create table with seq to determine the order */
/* Note: seq will not be displayed in the table because of NOPRINT */
proc report data=test3;
    columns seq service table ("Active" active active_pct) ("Reserve" reserve reserve_pct);
    define seq/noprint group order order=internal;
    define service/group "Service";
    define table/group "Table";
    define active/'N' format=comma10.0;
    define active_pct/'%' format=percent8.2;
    define reserve/'N' format=comma10.0;
    define reserve_pct/'%' format=percent8.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: the creation of variable seq is done when creating data set test3, but it could have been placed in the code when creating data set test2 (simplifying the code somewhat).&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 16:30:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924401#M363862</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-15T16:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924405#M363864</link>
      <description>&lt;P&gt;Any format based solution to order pretty much means that you have to provide something that handles all the values.&lt;/P&gt;
&lt;P&gt;Since your example output does not include the "TOTAL" that was in your previous question and adds a value not there it's pretty hard to demonstrate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the PRELOADFMT option with ORDER=DATA on the Define. If you create the format with the NOTSORTED option then the values will display in the Format definition order:&lt;/P&gt;
&lt;P&gt;This uses a different order to show that it forces to a different order than the data set. Since you did not include a specific place for TOTAL I exclude that from Proc Report with the Where since just demonstrating this format and option set. This uses the Test2 data set created in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s example.&lt;/P&gt;
&lt;PRE&gt;proc format;
value $service (notsorted)
'Girl'='Girl'
'Boy' ='Boy'
'Dad' ='Dad'
;
run;
proc report data=test2;
    where serv ne 'TOTAL';
    columns serv table ("Active" active active_pct) ("Reserve" reserve reserve_pct);
    define serv/group "Serv" format=$service. preloadfmt order=data;
    define table/group "Table";
    define active/'N' format=comma10.0;
    define active_pct/'%' format=percent8.2;
    define reserve/'N' format=comma10.0;
    define reserve_pct/'%' format=percent8.2;
run;&lt;/PRE&gt;
&lt;P&gt;To place "Busy Z" in a specific order in your data you would add it to the format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 17:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924405#M363864</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-15T17:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924419#M363868</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; Thank you for sharing your knowledge. This means alot to me as I continue to learn SAS. Two last question please.&lt;/P&gt;&lt;P&gt;1. How do I learn data manipulation? Is there any book/material you can recommend.&lt;/P&gt;&lt;P&gt;2. If you see my initial main table, active and reserve are under component.&amp;nbsp; How can I create a proc report that will show that table exactly like that- where active and reserve will be under component like this below.&amp;nbsp;I tried it by adding component to the group in proc report but i did not get the expected outcome.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CathyVI_0-1713213505137.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95553iA869FA54746E1877/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CathyVI_0-1713213505137.png" alt="CathyVI_0-1713213505137.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 20:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924419#M363868</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-04-15T20:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924430#M363874</link>
      <description>&lt;P&gt;UNTESTED&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;columns seq service table ("Component ("Active" active active_pct) ("Reserve" reserve reserve_pct));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can you learn data manipulation? I don't have a complete set of instructions. The main thing is that you do lots of it. No one who is new at this is going to be able to manipulate data as well as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; and I (well, at least as well as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; ). Here are some other things that I see are important, based upon what I see among the younger data analysts where I work. Please note: THESE ARE MY OPINIONS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Learn to get really really good at DATA steps, PROC SUMMARY and either PROC REPORT or PROC TABULATE. These are your main calculation engines and display engines. This doesn't mean that you can't use other PROCs, but those should be secondary to the above, and use them when the above can't get you where you are going.&lt;/LI&gt;
&lt;LI&gt;Do not use PROC SQL as a data analysis engine. The above PROCs are simply much more powerful. Just because you can do &lt;STRONG&gt;a lot&lt;/STRONG&gt; of data manipulation in PROC SQL, that doesn't mean you SHOULD do &lt;STRONG&gt;a lot of&lt;/STRONG&gt; data manipulation in SQL. SQL is really good at extracting from databases, and joining tables, and similar operations, that is when you should use SQL. It also can do some things easily that DATA steps can't do as easily. However, SQL is inefficient for doing &lt;STRONG&gt;lots of&lt;/STRONG&gt; calculations and creating reports and will require a lot of code; and it will run more slowly. Where I am, I see the younger people write code which has SQL after SQL for dozens/hundreds of lines; the same analysis in PROC SUMMARY would run faster and take less code. Example that I saw today (inefficient):&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table one as select mean(myvariable) from dataset;
quit;
proc sql;
    create table two as select mean(myvariable) from dataset where product='ABC';
quit;
proc sql;
    create table three as select mean(myvariable) from dataset where product='DEF';
quit;

data&amp;nbsp;stats;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp;one&amp;nbsp;two&amp;nbsp;three;
run;&lt;/CODE&gt;&lt;/PRE&gt;
Example: (less inefficient)&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table one as select mean(myvariable) from dataset;
quit;
proc sql;
    create table two as select product,mean(myvariable) from dataset group by product;
quit;
data stats;
    set one two;
run;&lt;/CODE&gt;&lt;/PRE&gt;
Example: (efficient)&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=dataset;
    class product;
    var myvariable;
    output out=stats mean=;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
There's actually more code needed to make the above (inefficent) and (less inefficient) code work properly, I left it out because the point I am making should be clear. You get the same numbers as a result, but the inefficient requires 12 lines and the efficient requires 5. And the efficient code will execute a lot faster than the inefficient code. And if there are additional products, such as GHI and JKL and so on, you have to keep adding to your inefficient code in a repetitive fashion. The efficient code requires nothing else to handle ABC DEF GHI and JKL properly.&lt;BR /&gt;&lt;BR /&gt;The "less inefficient" has less typing, but still not as little as the efficient code. And it will run slower than the efficient code.&lt;BR /&gt;&lt;BR /&gt;If you want to do this for two or more different GROUP BY variables, then SUMMARY blows SQL out of the water.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 22:24:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924430#M363874</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-15T22:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924433#M363877</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; Thank you for sharing your knowledge. This means alot to me as I continue to learn SAS. Two last question please.&lt;/P&gt;
&lt;P&gt;1. How do I learn data manipulation? Is there any book/material you can recommend.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The first step in anything related to programming, at least in my sometimes humble opinion: Clearly define the manipulation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I often find that when I don't get desired or expected results from code it is because I did not state clearly enough what the output would be and identify which step handles which requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's look at your second question about the column headings.&lt;/P&gt;
&lt;P&gt;When you looked &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s Column statement did you consider how the text "Active" is placed about the count and percent? or "Reserve"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's see this:&lt;/P&gt;
&lt;PRE&gt;proc report data=test2;
    columns serv table ("Component" ("Active" active active_pct) ("Reserve" reserve reserve_pct));
    define serv/group "Serv";
    define table/group "Table";
    define active/'N' format=comma10.0;
    define active_pct/'%' format=percent8.2;
    define reserve/'N' format=comma10.0;
    define reserve_pct/'%' format=percent8.2;
run;&lt;/PRE&gt;
&lt;P&gt;The ( ) on the Columns statement does column heading grouping. Adding an extra layer of () around the Active and Reserve groups places the text Component above those groups.&lt;/P&gt;
&lt;P&gt;The appearance was about COLUMN HEADING, not grouping by defines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 22:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924433#M363877</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-15T22:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924471#M363893</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. How do I learn data manipulation? Is there any book/material you can recommend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Also, &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxims of Maximally Efficient SAS Programmers&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Especially maxims 10, 12, 14 and 19, and all the rest are important too.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 10:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924471#M363893</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-16T10:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924705#M363967</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Thank you. This is extremely helpful. I found many people doing it and I follow the steps.&amp;nbsp; However, I tried your method on my data with multiple variables but am not getting it right.&amp;nbsp; I created the sex1, age1 and race1 similar to your "seq" and added it to the proc report. I am suspecting it is because my data has some missingness when I coded it. Here is a snapshot and the warning I am getting. How can I fix this. I used the sashelp.heart to practice but it looks fine.&amp;nbsp; Please can you explain how to use pro report to generate it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test1;
set test;
if sex='Male' then sex1=1;
else if sex='Female' then sex1=2;

if age='&amp;lt;20' then age1=1;
else if age='20-24' then age1=2;
else if age='25-29' then age1=3;
else if age='30-34' then age1=4;
else if age='35-39' then age1=5;
else if age='40-44' then age1=6;
else if age='45-49' then age1=7; 
else if age='50+'  then  age1=8;

if Race='White, non-Hispanic' then race1=1;
else if Race ='Black, non-Hispanic' then race1=2;
else if Race = 'Hispanic' then race1=3;
else if Race = 'Other' then race1=4;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I transpose it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CathyVI_0-1713364057641.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95628i95CE6830610B3145/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CathyVI_0-1713364057641.png" alt="CathyVI_0-1713364057641.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But when I use pro report, I got the warning and no output.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;34         proc report data=tab_final ;
35             columns  sex1 age1 race1 service1 varname Y2023_ percent23  ;
36         	define sex1/noprint group order order=internal;
37         	define age1/noprint group order order=internal;
38         	define race1/noprint group order order=internal;
39         	define service1/noprint group order order=internal;
40             define varname/group "Variables";
41             define Y2023_/'N' format=comma10.0;
42             define percent23/'%' format=percent8.2;
43         run;

&lt;FONT color="#FF0000"&gt;WARNING: A GROUP, ORDER, or ACROSS variable is missing on every observation.&lt;/FONT&gt;
NOTE: There were 23 observations read from the data set QC.TAB1_FINAL.
NOTE: PROCEDURE REPORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 14:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924705#M363967</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-04-17T14:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924708#M363968</link>
      <description>&lt;P&gt;Why are you transposing? It doesn't seem necessary. Is it to get the columns in a report? Then it certainly is NOT necessary, and in fact it is the wrong thing to do. Show us the report you want — type it in using Excel and show us the screen capture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember, no more transposing to get a report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if sex='Male' then sex1=1;
else if sex='Female' then sex1=2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if age='&amp;lt;20' then age1=1;
else if age='20-24' then age1=2;
else if age='25-29' then age1=3;
else if age='30-34' then age1=4;
else if age='35-39' then age1=5;
else if age='40-44' then age1=6;
else if age='45-49' then age1=7; 
else if age='50+'  then  age1=8;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it to control the order in a report? There are other ways (that are much easier) if things are already in order. Your ages are in order. Your sexes are in order. The reason I proposed a different approach earlier was you wanted an order that was not alphabetic.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924708#M363968</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-17T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924713#M363970</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Yes. I want to get the variables in the order for the report. This is the report table.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to quickly ask this here&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;How do I make my 'Total' to be placed at the top just as it is in this report table with pro report.&amp;nbsp; Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sex&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt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TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;50+&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Race/Ethnicity&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Non-Hispanic White&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Non-Hispanic Black&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Hispanic&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Other&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924713#M363970</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-04-17T15:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924714#M363971</link>
      <description>&lt;P&gt;Your very limited picture of the data shows every single row with one or more missing values for Sex1, Age1, Race1 and Service1. So you are getting the warning because of all that missing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the documentation of proc report in the Define section (emphasis added for any group so show why this is important.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xisDoc-refProc"&gt;
&lt;DIV class="xisDoc-refBlock"&gt;
&lt;DIV class="xisDoc-syntax"&gt;
&lt;DIV class="xisDoc-syntaxDescription"&gt;
&lt;DIV class="xisDoc-optionalArgGroup"&gt;
&lt;DIV id="p1pwrzo0hbbuw3n16flyf82j64z8" class="xisDoc-argDescriptionPair"&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;SECTION class="xisDoc-tableWrap"&gt;
&lt;TABLE class="xisDoc-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="xisDoc-summaryDefault"&gt;Default&lt;/TH&gt;
&lt;TD class="xisDoc-summaryText"&gt;If you omit the MISSING option, then PROC REPORT excludes from the report and the output data sets all observations that have a missing value for &lt;STRONG&gt;any group&lt;/STRONG&gt;, order, or across variable.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/SECTION&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The "fix" would be to add the MISSING option to the DEFINE statements for those group variables. However that will result in sections of the report created to display those missing values.&lt;/P&gt;
&lt;P&gt;You don't show the actual Transpose code for use with any of the example sets we have created but it seems moderately clear that however you did it the result is not usable for Proc Report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924714#M363971</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-17T15:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924716#M363972</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 14 — Use the right tool&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC REPORT is not the right tool for this type of output. Maybe PROC TABULATE will work, but I have almost no knowledge of PROC TABULATE. So maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;can step in and show how (if possible) you can get this from PROC TABULATE. I suspect he will need to see a portion of your original (untransposed) data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC REPORT produces rectangular tables where a variable (for example, YEAR) is going across the top and another variable (such as income catergories) goes down the first column. I'm guessing you could probably work very hard and make this table in PROC REPORT but I do not even want to think about working very hard to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If somewhere earlier in your code for this project, you wrote code to create the age category '20-24' in a variable AGE1, and similarly for sex and race, this is also counterproductive and makes more work than the much better method, which is to assign a custom format to the original variable. Then in reporting procedures, SAS is smart enough to be able to know that the values associated with '&amp;lt;20' come before the values associated with '20-24' and then put them in the proper order in the desired table, without you having to force an ordering. The reason we started with a seq variable was because it seemed as if you wanted possibly values in a table that were not in alphabetical order or not in numeric order.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924716#M363972</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-17T15:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924721#M363974</link>
      <description>&lt;P&gt;I'm going to insist that we stop here. I'm going to insist that in your first post in a thread, you describe the problem from the beginning all the way to the end, in words, without referring to SAS code at all. Then you need to show us (a portion of) the original data (not the data transformed or transposed after a couple of steps) and show us the desired output. This is the proper way to ask for help and will lead to the most efficient discussions, by providing these items I just described. This is the only way for us to make progress efficiently. You need to provide this for &lt;STRONG&gt;EVERY&lt;/STRONG&gt; problem you want us to help with. No jumping into the middle and asking how to rename variable names; no jumping into the middle and wondering why your PROC REPORT has an error.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924721#M363974</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-17T15:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924723#M363976</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Yes. I want to get the variables in the order for the report. This is the report table.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to quickly ask this here&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;How do I make my 'Total' to be placed at the top just as it is in this report table with pro report.&amp;nbsp; Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;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D&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Other&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If your Total is computed from the values in the data then with Report that would be a RBREAK BEFORE;&lt;/P&gt;
&lt;P&gt;If you are forcing a column variable that has the value of total and associated in the data set then I think you are looking either adding an order variable that appears first in your Columns statement and has the NOPRINT options in the define along with order or a custom format and the Preloadfmt option. But from what you've said your data isn't ready.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/924723#M363976</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-17T15:32:03Z</dc:date>
    </item>
  </channel>
</rss>

