<?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: Statistics Table (How much does the variables blank cells represent in total amount) in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553204#M33533</link>
    <description>&lt;P&gt;Please read &lt;A href="https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192" target="_blank"&gt;https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192&lt;/A&gt; and help us so that we can help you.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Apr 2019 12:53:23 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-04-23T12:53:23Z</dc:date>
    <item>
      <title>SAS enterprise guide 7.1, Blank Count and Amount its representing</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553176#M33531</link>
      <description>&lt;P&gt;Dears,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a big data set containing more than 100 variables, am trying to have a statistical table representing Each Variable (Blank cells count and Blank cells percentage and an amount(another variable in the data set) that reflect the amount of blank cells of each variable.&lt;/P&gt;&lt;P&gt;Data Sample&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Socks&lt;/TD&gt;&lt;TD&gt;T-shirts&lt;/TD&gt;&lt;TD&gt;Shirts&lt;/TD&gt;&lt;TD&gt;Cost&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Large&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;X large&lt;/TD&gt;&lt;TD&gt;Small&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Small&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Large&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data output desired :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Variables&lt;/TD&gt;&lt;TD&gt;Blanks Count&lt;/TD&gt;&lt;TD&gt;Blanks %&lt;/TD&gt;&lt;TD&gt;Amount representing blank data&lt;/TD&gt;&lt;TD&gt;Amount %&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Socks&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;33%&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;33%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;T-shirts&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;67%&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;67%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Shirts&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;33%&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;17%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Either having it as a table representing all variables. Please not that i am a beginner on SAS enterprise guide and am not good with coding. my plan was to do it by the query builder or by statistics tables.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 04:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553176#M33531</guid>
      <dc:creator>drawerder</dc:creator>
      <dc:date>2019-04-24T04:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Statistics Table (How much does the variables blank cells represent in total amount)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553204#M33533</link>
      <description>&lt;P&gt;Please read &lt;A href="https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192" target="_blank"&gt;https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192&lt;/A&gt; and help us so that we can help you.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 12:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553204#M33533</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-04-23T12:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Statistics Table (How much does the variables blank cells represent in total amount)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553285#M33538</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*This program creates a report with the number and percent of
missing data for each variable in the data set.
The ony change should be to the macro variable, INPUT_DSN.
Author: F. Khurshed
Date: 2019-01-04
*/
*create sample data to work with;

data class;
    set sashelp.class;

    if age=14 then
        call missing(height, weight, sex);

    if name='Alfred' then
        call missing(sex, age, height);
    label age="Fancy Age Label";
run;

*set input data set name;
%let INPUT_DSN = class;
%let OUTPUT_DSN = want;
*create format for missing;

proc format;
    value $ missfmt ' '="Missing" other="Not Missing";
    value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods select none;
*turns off the output so the results do not get too messy;
ods table onewayfreqs=temp;

proc freq data=&amp;amp;INPUT_DSN.;
    table _all_ / missing;
    format _numeric_ nmissfmt. _character_ $missfmt.;
run;

ods select all;
*Format output;

data long;
    length variable $32. variable_value $50.;
    set temp;
    Variable=scan(table, 2);
    Variable_Value=strip(trim(vvaluex(variable)));
    presentation=catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
    keep variable variable_value frequency percent cum: presentation;
    label variable='Variable' variable_value='Variable Value';
run;

proc sort data=long;
    by variable;
run;

*make it a wide data set for presentation, with values as N (Percent);

proc transpose data=long out=wide_presentation (drop=_name_);
    by variable;
    id variable_value;
    var presentation;
run;

*transpose only N;

proc transpose data=long out=wide_N prefix=N_;
    by variable;
    id variable_value;
    var frequency;
run;

*transpose only percents;

proc transpose data=long out=wide_PCT prefix=PCT_;
    by variable;
    id variable_value;
    var percent;
run;

*final output file;

data &amp;amp;Output_DSN.;
    merge wide_N wide_PCT wide_presentation;
    by variable;
    drop _name_;
    label N_Missing='# Missing' N_Not_Missing='# Not Missing' 
        PCT_Missing='% Missing' N_Not_Missing='% Not Missing' Missing='Missing' 
        Not_missing='Not Missing';
run;

title "Missing Report of &amp;amp;INPUT_DSN.";

proc print data=&amp;amp;output_dsn. noobs label;
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/270638"&gt;@drawerder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dears,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a big data set containing more than 100 variables, am trying to have a statistical table representing Each Variable (Blank cells count and Blank cells percentage and an amount(another variable in the data set) that reflect the amount of blank cells of each variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553285#M33538</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-23T14:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Statistics Table (How much does the variables blank cells represent in total amount)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553294#M33540</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270638"&gt;@drawerder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dears,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a big data set containing more than 100 variables, am trying to have a statistical table representing Each Variable (Blank cells count and Blank cells percentage and an amount(another variable in the data set) that reflect the amount of blank cells of each variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hint: Create a small data set with 3 or 4 variables such that you can determine what the results for that set should look like. Provide the data and the desired result.&lt;/P&gt;
&lt;P&gt;Is the result supposed to be a report that people read or a data set used by other processes?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553294#M33540</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-23T14:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Statistics Table (How much does the variables blank cells represent in total amount)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553540#M33554</link>
      <description>&lt;P&gt;Sorry for the inconveniences. I have updated the question for better understanding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 07:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553540#M33554</guid>
      <dc:creator>drawerder</dc:creator>
      <dc:date>2019-04-24T07:17:59Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553592#M33559</link>
      <description>&lt;P&gt;I updated the post, Kindly check it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your comment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 11:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553592#M33559</guid>
      <dc:creator>drawerder</dc:creator>
      <dc:date>2019-04-24T11:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Re:</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553820#M33563</link>
      <description>You need to explain that logic. Why does Socks have count=1, amount=40? Where do those values come from? Did you run/test the code I posted? It does what you need.</description>
      <pubDate>Thu, 25 Apr 2019 00:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553820#M33563</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-25T00:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Re:</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553880#M33564</link>
      <description>&lt;P&gt;Socks Column has 3 cells with (Large,&lt;FONT color="#FF0000"&gt;Blank&lt;/FONT&gt;,Small) so there are&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt; 2 non blanks&lt;/FONT&gt; and 1 blank. &lt;FONT color="#000000"&gt;the amount &lt;FONT color="#FF0000"&gt;40&lt;/FONT&gt; is the cost associated&amp;nbsp;with the blank.&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Your code already has variables from the data (CLass), after i entered the code and changed data name. all summaries and tables are representing (Height, sex, Age).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 07:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/553880#M33564</guid>
      <dc:creator>drawerder</dc:creator>
      <dc:date>2019-04-25T07:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Re:</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/554446#M33589</link>
      <description>&lt;P&gt;If you want to do this in EG yourself, you need to create a custom format to show MISSING/NON-MISSING, as I did above (see the comments). You can do this via the GUI interface to create a user format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you apply the formats to your data set - not sure how in EG you'll need to google that. One option would be to add it in via Query Builder or via the &lt;A href="https://documentation.sas.com/?docsetId=egamotasks&amp;amp;docsetVersion=8.0&amp;amp;docsetTarget=p1f1wcg7b35d7yn11fuzuhiwbxys.htm&amp;amp;locale=en" target="_self"&gt;assign column properties options&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then run a One Way Frequency task on it twice, once with all the variables you want summarized.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then again, with using the AMOUNT as the Weight variable. Then merge the two results together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: Search on here and someone posted an answer that would solve this is less steps by using a transpose task first and then doing a &amp;nbsp;one way frequency on that instead. I don't have EG to test that though. You may also want to try the Characterize Data task, it may have it all done for you but I don't recall the options and don't have EG anymore to check.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a code version. First run it exactly as posted and see the results that are generated. If that's what you want then change the section in red, specifically replace CLASS to be the variable name of interest and WANT with the name of the output data set you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Coding is always more efficient, since I've now written this program in a generic fashion, the next time I need to do this I change the input data set name and it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; More likely though, I can copy that first section which is a useful program for me. There are other ways but this works quite well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data class;
    set sashelp.class;

    if age=14 then
        call missing(height, weight, sex);

    if name='Alfred' then
        call missing(sex, age, height);
    label age="Fancy Age Label";
    amount=rand('integer', 10, 100);
run;

&lt;FONT size="6" color="#000000"&gt;&lt;FONT color="#339966"&gt;*set input data set name;&lt;/FONT&gt;
&lt;FONT color="#993366"&gt;%let INPUT_DSN&lt;/FONT&gt; = &lt;FONT color="#FF0000"&gt;class&lt;/FONT&gt;; &lt;FONT color="#339966"&gt;*change these lines only - input data set name;&lt;/FONT&gt;
&lt;FONT color="#993366"&gt;%let OUTPUT_DSN&lt;/FONT&gt; = &lt;FONT color="#FF0000"&gt;want&lt;/FONT&gt;; &lt;FONT color="#339966"&gt;*output data set name;&lt;/FONT&gt;&lt;/FONT&gt;

*create format for missing;

proc format;
    value $ missfmt ' '="Missing" other="Not Missing";
    value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods select none;
*turns off the output so the results do not get too messy;
ods table onewayfreqs=temp1;

proc freq data=&amp;amp;INPUT_DSN.;
    table _all_ / missing out=temp_Check;
    format _numeric_ nmissfmt. _character_ $missfmt.;
run;

*clean up output to reduce clutter;
data long1;
    length variable $32. variable_value $50.;
    set temp1;
    *find name of variable being summarized;
    Variable=scan(table, 2);
    
    *getting value from correct variable - using variable name as lookup retrieved via VVALUEX() function;
    *note this returns a character value;
    Variable_Value=strip(trim(vvaluex(variable)));
    
    *create a presentation variable that is N(##.#%) format;
    presentation=catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
    
    *keep only variables of interest;
    keep variable variable_value frequency percent presentation;
  
run;

*sort for merging;
proc sort data=long1;
    by variable;
run;

ods select all;

*Proc freq to count missing/non missing;
ods select none;
*turns off the output so the results do not get too messy;
ods table onewayfreqs=temp2;

proc freq data=&amp;amp;INPUT_DSN.;
    table _all_ / missing;
    weight amount;
    format _numeric_ nmissfmt. _character_ $missfmt.;
run;

ods select all;

*clean up output to reduce clutter;
data long2;
    length variable $32. variable_value $50.;
    set temp2;
    *find name of variable being summarized;
    Variable=scan(table, 2);
    
    *getting value from correct variable - using variable name as lookup;
    *note this is a character value;
    Variable_Value=strip(trim(vvaluex(variable)));
    
    *create a presentation variable that is N(##.#%) format;
    presentation=catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
    
    *keep only variables of interest;
    keep variable variable_value frequency percent presentation;
  
run;

*sort for merging;
proc sort data=long2;
    by variable;
run;

data want;
*merge but rename variables first to make them represent values you wanted;
*note that if you merge without renaming it's problematic because the variables will overwrite each other;

merge long1 (rename= (frequency = BlankCounts percent = BlankPct presentation=BlankPres)) 
      long2 (rename= (frequency =AmountBlank percent =AmountBlankPct presentation=AmountBlankPres ));

by variable variable_value;

*commented out where clause that would limit it to missing only;
where variable_value='Missing';
run;

&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Apr 2019 04:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/554446#M33589</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-27T04:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Re:</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/554447#M33590</link>
      <description>I've tried to comment the code quite thoroughly but if you have any questions about any line feel free to ask. HTH.</description>
      <pubDate>Sat, 27 Apr 2019 04:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-enterprise-guide-7-1-Blank-Count-and-Amount-its-representing/m-p/554447#M33590</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-27T04:16:51Z</dc:date>
    </item>
  </channel>
</rss>

