<?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: calculate missing values by ID for specific variables in a data set in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901938#M40242</link>
    <description>&lt;P&gt;I have 11 items that measured across three time points. I need to calculate missing percentages for each individual and remove individuals who have %75 of missing values. I used the following syntax but it gave me the item level missingness. I need to calculate missing percentages for these variables for each individual.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;PRE&gt;generate counts of N/NMISS;
proc means data=FINAL stackods n nmiss NWAY;
class ID;
var 
EXP1_T1
EXP2_T1
EXP3_T1
EXP4_T1
EXP5_T1
INT1_T1
INT2_T1
INT3_T1R
UTL1_T1
UTL2_T1
UTL3_T1
EXP1_T2
EXP2_T2
EXP3_T2
EXP4_T2
EXP5_T2
INT1_T2
INT2_T2
INT3_T2R
UTL1_T2
UTL2_T2
UTL3_T2
EXP1_T3
EXP2_T3
EXP3_T3
EXP4_T3
EXP5_T3
INT1_T3
INT2_T3
INT3_T3R
UTL1_T3
UTL2_T3
UTL3_T3;
ods output summary=summary_stats;
run;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Nov 2023 18:25:29 GMT</pubDate>
    <dc:creator>emilync</dc:creator>
    <dc:date>2023-11-07T18:25:29Z</dc:date>
    <item>
      <title>calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901934#M40239</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;How can I calculate percentage of missing values for each individual for specific variables in SAS?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901934#M40239</guid>
      <dc:creator>emilync</dc:creator>
      <dc:date>2023-11-07T18:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901935#M40240</link>
      <description>&lt;P&gt;Please show us the layout of the data in the SAS data set. (It can be fake data, as long as the organization of the data is clear)&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901935#M40240</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-07T18:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901936#M40241</link>
      <description>&lt;P&gt;What do you currently have?&lt;/P&gt;
&lt;P&gt;What rules are involved in the calculation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide some example data in the form of a working data step, the rules involved and an example of the result.&lt;/P&gt;
&lt;P&gt;Or at least post some values as text into a text box opened on the forum with &amp;lt;/&amp;gt; icon above the message box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise the answer is "42".&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901936#M40241</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-11-07T18:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901938#M40242</link>
      <description>&lt;P&gt;I have 11 items that measured across three time points. I need to calculate missing percentages for each individual and remove individuals who have %75 of missing values. I used the following syntax but it gave me the item level missingness. I need to calculate missing percentages for these variables for each individual.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;PRE&gt;generate counts of N/NMISS;
proc means data=FINAL stackods n nmiss NWAY;
class ID;
var 
EXP1_T1
EXP2_T1
EXP3_T1
EXP4_T1
EXP5_T1
INT1_T1
INT2_T1
INT3_T1R
UTL1_T1
UTL2_T1
UTL3_T1
EXP1_T2
EXP2_T2
EXP3_T2
EXP4_T2
EXP5_T2
INT1_T2
INT2_T2
INT3_T2R
UTL1_T2
UTL2_T2
UTL3_T2
EXP1_T3
EXP2_T3
EXP3_T3
EXP4_T3
EXP5_T3
INT1_T3
INT2_T3
INT3_T3R
UTL1_T3
UTL2_T3
UTL3_T3;
ods output summary=summary_stats;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901938#M40242</guid>
      <dc:creator>emilync</dc:creator>
      <dc:date>2023-11-07T18:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901939#M40243</link>
      <description>&lt;P&gt;Add one more piece of code where the percent missing is computed in a DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set summary_stats;
    percent_missing=100*nmiss/sum(n,nmiss);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901939#M40243</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-07T18:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901941#M40244</link>
      <description>&lt;P&gt;Just a suggestion, variable lists are helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a reference that illustrates how to refer to variables and datasets in a short cut list:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901941#M40244</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-11-07T18:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901942#M40245</link>
      <description>&lt;P&gt;Thank you. This code gave me whether the participant responded each question. However, I need to calculate how much percent missing values each participant have across three time points. And I need to exclude the participants who have %75 or above missing values across three waves. Is there something that I am missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data FINAL;
    set summary_stats;
    percent_missing=100*nmiss/sum(n,nmiss);
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emilync_0-1699382352642.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89499iE70C952F29311E05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="emilync_0-1699382352642.png" alt="emilync_0-1699382352642.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901942#M40245</guid>
      <dc:creator>emilync</dc:creator>
      <dc:date>2023-11-07T18:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901943#M40246</link>
      <description>&lt;P&gt;The issue of "across 3 waves" has not been mentioned before and requires explanation. As far as the concept of eliminating people who have more than 75% of the data, once you compute the percents, you simply delete the rows where the percent is &amp;gt; 75%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I repeat my earlier request that you show us the arrangement of the data (even if it is fake data, it must represent the actual arrangement of the data). Please note: last time I asked for the arrangement of the data, you provided SAS code, which is not what I was asking for. I want to see the (fake) data in its actual arrangement in your data set, so that it is obvious what you are working with and so that I can help you write code that works on your data.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901943#M40246</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-07T18:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901950#M40247</link>
      <description>&lt;P&gt;Additional comment:&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/459905"&gt;@emilync&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data FINAL;
    set summary_stats;
    percent_missing=100*nmiss/sum(n,nmiss);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is poor programming practice, creating a data set named FINAL when your original data set (the one used in PROC MEANS) was also named FINAL. You have overwritten your original data with the PROC MEANS output. I can't think of a situation where this is really a good thing to do.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901950#M40247</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-07T18:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901951#M40248</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emilync_0-1699383353777.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89500i31D491A2307653C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="emilync_0-1699383353777.png" alt="emilync_0-1699383353777.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Sorry. It worked!&amp;nbsp; I checked the results viewer section instead of the library. The percentage of missing values are available in the library.&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:57:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901951#M40248</guid>
      <dc:creator>emilync</dc:creator>
      <dc:date>2023-11-07T18:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901954#M40249</link>
      <description>&lt;P&gt;&amp;nbsp;Thank you! I forgot to ask the second part of the question. This is a longitudinal dataset that the same participants assessed across three time points. I attached the arrangement of the data that I used (SAV file). I really appreciate if you could provide a suggestion to remove individuals from the data set who have %75 or above missing data across three time points?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emilync_0-1699384244044.png" style="width: 747px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89506i0FFC026154994606/image-dimensions/747x88?v=v2" width="747" height="88" role="button" title="emilync_0-1699384244044.png" alt="emilync_0-1699384244044.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 19:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901954#M40249</guid>
      <dc:creator>emilync</dc:creator>
      <dc:date>2023-11-07T19:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: calculate missing values by ID for specific variables in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901977#M40250</link>
      <description>&lt;P&gt;Is -99 coded as missing? If so, proc means won't get you what you need (and neither will this though it can be easily modified).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming this is a SAS data set (since it's a SAS forum) here's how I'd do it in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data exclusion_list;
set have;
by id;
retain tot_miss;
array _vars(*) ex: int: ut:;

nmissing = nmiss(of _vars(*));

if first.id then tot_miss=0;
tot_miss + nmissing;

if last.id then pct_missing = tot_miss / dim(_vars)*3;

if pct_missing &amp;gt;= 0.75;

keep id;
run;

proc sql;
create table included_records as
select * 
from have
where id not in (select id from exclusion_list);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Nov 2023 20:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/calculate-missing-values-by-ID-for-specific-variables-in-a-data/m-p/901977#M40250</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-11-07T20:51:05Z</dc:date>
    </item>
  </channel>
</rss>

