<?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: How can i get mean for char type attribute? (During data pre-processing) in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533851#M16494</link>
    <description>&lt;P&gt;Thank you for reply again!&lt;/P&gt;&lt;P&gt;Actually I cannot use method which is removing outliers&amp;nbsp; or invalid value from my data set.&lt;/P&gt;&lt;P&gt;Instead of this method, I have to use others method for data-reprocessing, thats why i try ting to replace the value at the begin.&lt;/P&gt;&lt;P&gt;Since i cannot remove the value, can you give me any good idea to handle this?&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;</description>
    <pubDate>Fri, 08 Feb 2019 05:50:15 GMT</pubDate>
    <dc:creator>eunbi</dc:creator>
    <dc:date>2019-02-08T05:50:15Z</dc:date>
    <item>
      <title>How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533524#M16484</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am beginner and a person who are newly learning SAS.&lt;/P&gt;&lt;P&gt;I am trying to data pre-processing and have question. I can calculate mean for numeric type of attribute in SAS well.&lt;/P&gt;&lt;P&gt;Here have question! In case of char type of attribute, how can we get mean?&lt;/P&gt;&lt;P&gt;(Logically thinking, chart type attribute cannot calculate mean I think. In this case, to handle missing value, Can i use frequency result?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, below is frequency result for job. I think NA is missing value here and want to replace to handle it. I can find the most high column of result : management. And I thought, I can replace the NA result to management. Is it okay? Or Is there any solution can you advice me?? Appreciate so much in advanced&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas question.png" style="width: 339px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26936iB8249D313CBFB81B/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas question.png" alt="sas question.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 07:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533524#M16484</guid>
      <dc:creator>eunbi</dc:creator>
      <dc:date>2019-02-07T07:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533531#M16485</link>
      <description>&lt;P&gt;Missing values are shown as an addendum to the table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
if name = 'Alfred' then call missing(sex);
run;

proc freq data=class;
tables sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;                                 Kumuliert     Kumuliert
Sex    Häufigkeit    Prozent     Häufigkeit      Prozent
--------------------------------------------------------
F              9      50.00             9        50.00  
M              9      50.00            18       100.00  

                 Frequency Missing = 1
&lt;/PRE&gt;
&lt;P&gt;So it is obvious that 'NA' is a non-missing value in your dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you want to add the count for 'NA' to the highest frequency result?&lt;/P&gt;
&lt;P&gt;Create an intermediary table, and manipulate that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
if name = 'Alfred' then sex = 'X';
run;

proc freq data=class noprint;
tables sex/out=result;
run;

data want;
keepmax = 0;
do until (eof1); * retrieve the value for 'X' and determine the max observation;
  set result end=eof1;
  if sex = 'X' then add = count;
  if count &amp;gt; keepmax
  then do;
    keepmax = count;
    keepval = sex;
  end;
end;
do until (eof2); * modify the table;
  set result end=eof2;
  if sex ne 'X' then do; * this prevents X from going to the output;
    if sex = keepval then count + add;
    output;
  end;
end;
drop keepmax keepval add;
run;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Feb 2019 07:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533531#M16485</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-07T07:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533689#M16486</link>
      <description>&lt;P&gt;I think you’re trying to impute missing? And replacing it with management is not a good way to do that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, why are they empty, or is NA a valid value?&lt;/P&gt;
&lt;P&gt;Second, how will this variable be used?&lt;/P&gt;
&lt;P&gt;Third, if it is missing, 19 is a smalll number, does it make sense to exclude these obs?&lt;/P&gt;
&lt;P&gt;Lastly, if not, &amp;nbsp;the you can look at imputation methods. Or basically try to predict what that value would be.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/258856"&gt;@eunbi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am beginner and a person who are newly learning SAS.&lt;/P&gt;
&lt;P&gt;I am trying to data pre-processing and have question. I can calculate mean for numeric type of attribute in SAS well.&lt;/P&gt;
&lt;P&gt;Here have question! In case of char type of attribute, how can we get mean?&lt;/P&gt;
&lt;P&gt;(Logically thinking, chart type attribute cannot calculate mean I think. In this case, to handle missing value, Can i use frequency result?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, below is frequency result for job. I think NA is missing value here and want to replace to handle it. I can find the most high column of result : management. And I thought, I can replace the NA result to management. Is it okay? Or Is there any solution can you advice me?? Appreciate so much in advanced&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas question.png" style="width: 339px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26936iB8249D313CBFB81B/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas question.png" alt="sas question.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 18:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533689#M16486</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-07T18:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533839#M16490</link>
      <description>&lt;P&gt;Hi Sir!&lt;/P&gt;&lt;P&gt;Thank you for the reply so much. So you mean that NA is not missing value?&lt;/P&gt;&lt;P&gt;You guided me "&lt;SPAN&gt;Missing values are shown as an addendum to the table" here what exactly mean "addendum" ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Unfortunately&lt;SPAN&gt;&amp;nbsp;i couldn't really get your guidance. ㅠㅠ sorry&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 04:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533839#M16490</guid>
      <dc:creator>eunbi</dc:creator>
      <dc:date>2019-02-08T04:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533844#M16491</link>
      <description>&lt;P&gt;Hi Sir!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for reply! Below is my response for your questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, why are they empty, or is NA a valid value?&lt;/P&gt;&lt;P&gt;&amp;gt; NA is not valid value. I am trying to learn data pre-processing with given data set now.&lt;/P&gt;&lt;P&gt;Second, how will this variable be used?&lt;/P&gt;&lt;P&gt;&amp;gt; Currently i have two data sets. One is train and the other is test. Once i done data pre-processing. I will try to estimate car insurance marking result based on the train data set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Third, if it is missing, 19 is a smalll number, does it make sense to exclude these obs?&lt;/P&gt;&lt;P&gt;&amp;gt; Can consider of course as one of method of data cleaning. However i hope to&amp;nbsp;correct inconsistencies in data.&lt;/P&gt;&lt;P&gt;Lastly, if not, &amp;nbsp;the you can look at imputation methods. Or basically try to predict what that value would be.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt; Based on the train data set i will predict marking result with test data set.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 05:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533844#M16491</guid>
      <dc:creator>eunbi</dc:creator>
      <dc:date>2019-02-08T05:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533845#M16492</link>
      <description>NA is typically Not Applicable. Whether that's missing in your context is not something we can possibly know.</description>
      <pubDate>Fri, 08 Feb 2019 05:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533845#M16492</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-08T05:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533846#M16493</link>
      <description>Imputation can also be a prediction step. So first predict the category and then predict the outcome. In fact, you can try several different methods and see how they affect your output, though I suspect with 19 you're not going to see much differences.</description>
      <pubDate>Fri, 08 Feb 2019 05:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533846#M16493</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-08T05:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533851#M16494</link>
      <description>&lt;P&gt;Thank you for reply again!&lt;/P&gt;&lt;P&gt;Actually I cannot use method which is removing outliers&amp;nbsp; or invalid value from my data set.&lt;/P&gt;&lt;P&gt;Instead of this method, I have to use others method for data-reprocessing, thats why i try ting to replace the value at the begin.&lt;/P&gt;&lt;P&gt;Since i cannot remove the value, can you give me any good idea to handle this?&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 05:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533851#M16494</guid>
      <dc:creator>eunbi</dc:creator>
      <dc:date>2019-02-08T05:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533853#M16495</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/258856"&gt;@eunbi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Sir!&lt;/P&gt;
&lt;P&gt;Thank you for the reply so much. So you mean that NA is not missing value?&lt;/P&gt;
&lt;P&gt;You guided me "&lt;SPAN&gt;Missing values are shown as an addendum to the table" here what exactly mean "addendum" ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Unfortunately&lt;SPAN&gt;&amp;nbsp;i couldn't really get your guidance. ㅠㅠ sorry&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In my post, I artificially created a missing value, and then ran proc freq over the resulting dataset. That proc freq created this line in the output:&lt;/P&gt;
&lt;PRE&gt;Frequency Missing = 1&lt;/PRE&gt;
&lt;P&gt;Since you do not have such a line in your output, it is clear that the 'NA' are actual values (and not just created by a special format for missing), and SAS will not treat them as missing. If NA stands for "not applicable", you should convert these values to missing (empty string) when importing the data into SAS. SAS usually excludes missing values automatically from calculations where such makes sense.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 06:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533853#M16495</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-08T06:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533855#M16496</link>
      <description>&lt;P&gt;Oh I finally understand what you explained to me. Thank you so much Sir!&lt;/P&gt;&lt;P&gt;I think below article would be helpful who have similar curiosity too.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002316433.htm" target="_blank" rel="noopener"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002316433.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way can i modify the table with below codes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc iml;
edit WORK.CARINSURANCE_TRAIN;
read all var {job} where (job = "NA");
job = "management";
replace all var {job} where (job = "NA");
close WORK.CARINSURANCE_TRAIN;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 07:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533855#M16496</guid>
      <dc:creator>eunbi</dc:creator>
      <dc:date>2019-02-08T07:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533858#M16497</link>
      <description>&lt;P&gt;Do such a replace in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.carinsurance_train;
set work.carinsurance_train;
if job = 'NA' then job = 'management';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 07:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533858#M16497</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-08T07:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get mean for char type attribute? (During data pre-processing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533859#M16498</link>
      <description>&lt;P&gt;Thank you for sharing your knowledge with me!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 07:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-can-i-get-mean-for-char-type-attribute-During-data-pre/m-p/533859#M16498</guid>
      <dc:creator>eunbi</dc:creator>
      <dc:date>2019-02-08T07:40:56Z</dc:date>
    </item>
  </channel>
</rss>

