<?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: dynamic counting of non missing observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858837#M339326</link>
    <description>&lt;P&gt;I have been using proc freq to get non missing counts, as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc format; value missfmt .,0 ='Missing' other='Not Missing';
proc freq data=want; format var1--var50 missfmt.; tables var1--var50;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also did a static non missing count for all 50 vars, as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data work.nm; set have end=eof; array vars var1-var50;
	array nonmiss[50]; do i=1 to dim(vars) while (vars[i]); nonmiss[i]+1; end; if eof; keep nonmiss:;
proc print data=work.nm;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2023 21:24:48 GMT</pubDate>
    <dc:creator>Satori</dc:creator>
    <dc:date>2023-02-14T21:24:48Z</dc:date>
    <item>
      <title>dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858609#M339236</link>
      <description>&lt;P&gt;I have a dataset with about 50 variables. I want to do a dynamic counting of non missing values for these variables, meaning that I start with the variable with the most non missing observations (var1), then I want to add a second variable (var2) and count the number of non missing observations for both var1 and var2, whereby the number of non missing is the highest possible among the existing variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I have just five variables:&lt;/P&gt;&lt;P&gt;var1 non missing 1000&lt;/P&gt;&lt;P&gt;var2&amp;nbsp;non missing 800&lt;/P&gt;&lt;P&gt;var3&amp;nbsp;non missing 400&lt;/P&gt;&lt;P&gt;var4&amp;nbsp;non missing 850&lt;/P&gt;&lt;P&gt;var5&amp;nbsp;non missing 330&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would start with var1, and then count the number of observations with non missing of two variables.&lt;/P&gt;&lt;P&gt;var1+var2&amp;nbsp;non missing 720&lt;/P&gt;&lt;P&gt;var1+var3&amp;nbsp;non missing 780&lt;/P&gt;&lt;P&gt;var1+var4&amp;nbsp;non missing 620&lt;/P&gt;&lt;P&gt;var1+var5&amp;nbsp;non missing 150&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then var1+var3 give me the most observations, so I would keep them and continue with the most number of observations with non missing for three variables.&lt;/P&gt;&lt;P&gt;var1+var3+var2&lt;/P&gt;&lt;P&gt;var1+var3+var4&lt;/P&gt;&lt;P&gt;var1+var3+var5&lt;/P&gt;&lt;P&gt;etc. until I have the result for all the variables (5 in this example). A possible result being var1+var3+var2+var5+var4&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, 13 Feb 2023 20:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858609#M339236</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-13T20:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858610#M339237</link>
      <description>&lt;P&gt;Are we to assume that all these variables are numeric? Or are we to assume that all these variables are character? Or are we to assume that some are numeric and some are character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 50C1 + 50C2 + ... + 50C50 (where the C indicates combinations, 50C2 is the number of ways that 50 variables can be combined 2 at a time) possible combinations, that's 1,125,899,906,842,618, for more than is realistically possible to compute. So now what?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 20:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858610#M339237</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-13T20:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858615#M339238</link>
      <description>&lt;P&gt;If I'm reading correctly the OP wants 50C1 + 49C1 + 48C1 ... 1C1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run PROC MEANS on all 50 variables, select the variable with the highest N.&amp;nbsp; Call that variable X.&lt;/P&gt;
&lt;P&gt;Then run PROC MEANS on 49 variables where n(X)=1, and select the variable with the highest N.&amp;nbsp; Call that variable Y.&lt;/P&gt;
&lt;P&gt;Then run PROC MEANS on 48 variables where n(X,Y)=2, and select the variable with the highest N&amp;nbsp; Call that variable Z.&lt;/P&gt;
&lt;P&gt;Then run PROC MEANS on 47 variables where n(X,Y,Z)=3, and select the variable with the highest N....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So it could be done with 50 PROC MEANS steps in a macro or whatever.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that what you want,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173636"&gt;@Satori&lt;/a&gt;&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm curious to the big picture as to why you want to do this.&amp;nbsp; I don't think this sort of stepwise approach will necessarily give you an optimal combination of variables.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 20:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858615#M339238</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-13T20:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858624#M339241</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173636"&gt;@Satori&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a dataset with about 50 variables. I want to do a dynamic counting of non missing values for these variables, meaning that I start with the variable with the most non missing observations (var1), then I want to add a second variable (var2) and count the number of non missing observations for both var1 and var2, whereby the number of non missing is the highest possible among the existing variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if I have just five variables:&lt;/P&gt;
&lt;P&gt;var1 non missing 1000&lt;/P&gt;
&lt;P&gt;var2&amp;nbsp;non missing 800&lt;/P&gt;
&lt;P&gt;var3&amp;nbsp;non missing 400&lt;/P&gt;
&lt;P&gt;var4&amp;nbsp;non missing 850&lt;/P&gt;
&lt;P&gt;var5&amp;nbsp;non missing 330&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would start with var1, and then count the number of observations with non missing of two variables.&lt;/P&gt;
&lt;P&gt;var1+var2&amp;nbsp;non missing 720&lt;/P&gt;
&lt;P&gt;var1+var3&amp;nbsp;non missing 780&lt;/P&gt;
&lt;P&gt;var1+var4&amp;nbsp;non missing 620&lt;/P&gt;
&lt;P&gt;var1+var5&amp;nbsp;non missing 150&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then var1+var3 give me the most observations, so I would keep them and continue with the most number of observations with non missing for three variables.&lt;/P&gt;
&lt;P&gt;var1+var3+var2&lt;/P&gt;
&lt;P&gt;var1+var3+var4&lt;/P&gt;
&lt;P&gt;var1+var3+var5&lt;/P&gt;
&lt;P&gt;etc. until I have the result for all the variables (5 in this example). A possible result being var1+var3+var2+var5+var4&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;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can you show us an example of how you use the Var3 as the second largest instead, for discussion, the 5th variable? I am having a hard time seeing where order of variable actually comes into this if the objective is to determine numbers of nonmissing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 21:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858624#M339241</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-13T21:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858740#M339293</link>
      <description>&lt;P&gt;yes, that is exactly what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The objective of doing this is to get the highest number of observations with information on all (or most) variables, so I can decide where to make a cutoff on the extra variables. For example if on variable 25 I have 1000 observations and by adding variable 26 (the next one with most non missing) it drops to 100, I will choose to not add variable 26 and the following ones (var26 to var50)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 14:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858740#M339293</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T14:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858741#M339294</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I chose Var3 randomly. It could be any of the variables. What I want is to add the variable that keeps the highest number of observations. The order only matters in the sense that I want to keep the highest possible number of obs., and the objective is to see how the number of observations decreases as variables are added.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 14:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858741#M339294</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T14:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858759#M339299</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173636"&gt;@Satori&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;I chose Var3 randomly. It could be any of the variables. What I want is to add the variable that keeps the highest number of observations. The order only matters in the sense that I want to keep the highest possible number of obs., and the objective is to see how the number of observations decreases as variables are added.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Are we to assume that all these variables are numeric? Or are we to assume that all these variables are character? Or are we to assume that some are numeric and some are character?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 15:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858759#M339299</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-14T15:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858762#M339300</link>
      <description>Variables are numeric and character, but can be converted to be all numeric</description>
      <pubDate>Tue, 14 Feb 2023 15:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858762#M339300</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T15:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858767#M339301</link>
      <description>&lt;P&gt;I'm going to take a step back now and try to look at the big picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Over the years, many statistical methods have been developed to handle missing data. SAS has two PROCs, PROC MI and PROC MIANALYZE, which handles missing values in a statistically appropriate way (depending on certain assumptions) based on imputing values to use in place of the missing values. There is also the EM (expectation maximization) algorithm in PROC PLS (and possibly in other PROCs, I'm not sure) that will handle missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The method you are proposing does not sound like any of this previously developed tools to handle missing values. You might want to consider using one of these methods already in SAS rather than try to invent your own. In fact, I would argue against inventing your own method unless none of the SAS methods already mention give you what you want, which is a way to handle missing values in a specific analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, I think your method might be useful if the missings appear at random; but if they are not random I'm highly suspicious that it will be a good method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All of this hinges on you explaining what you are going to do once you have your missing analysis completed, and despite several people asking what you plan to do with the results of your missing analysis, you have not yet explained. So before I put more energy into helping you out with this method, I need to understand the next steps, once you have completed this accounting of missing values.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 16:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858767#M339301</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-14T16:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858768#M339302</link>
      <description>actually I already explained the objective: get the highest number of observations with information on all (or most) variables. Doing this dynamic counting will allow me to see the decay in the number of observations by adding an extra variable. The goal is to decide where a cutoff is appropriate. For example if on variable 25 I have 1000 observations and by adding variable 26 (the next one with most non missing for all the previous 25 vars) it drops to 100, I will choose to not add variable 26 (as well as the following vars)</description>
      <pubDate>Tue, 14 Feb 2023 16:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858768#M339302</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T16:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858772#M339303</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173636"&gt;@Satori&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;actually I already explained the objective:&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No that's not what I was asking. I am (and others are) specifically asking about what happens NEXT, after you complete this missing value accounting. What are you going to do with this result? What is the next analysis?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 16:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858772#M339303</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-14T16:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858781#M339306</link>
      <description>&lt;P&gt;I'm not sure this method works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As an example, with this step-wise approach imagine you decide to keep three variables, and select Var1 Var2 Var3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's possible that Var1 Var3 Var4 would give you more non-missing records.&amp;nbsp; It all depends on how missing-ness is correlated across the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;think to find an optimal solution, you would have to test all the combinations, as Paige mentioned.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 17:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858781#M339306</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-14T17:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858788#M339310</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173636"&gt;@Satori&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;actually I already explained the objective: get the highest number of observations with information on all (or most) variables. Doing this dynamic counting will allow me to see the decay in the number of observations by adding an extra variable. The goal is to decide where a cutoff is appropriate. For example if on variable 25 I have 1000 observations and by adding variable 26 (the next one with most non missing for all the previous 25 vars) it drops to 100, I will choose to not add variable 26 (as well as the following vars)&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What if you added a numeric variable to your data that was a count of how many missing values it had?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  nmiss=0;
  nmiss = cmiss(of _all_);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now did a regression to see which variables best predict NMISS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would that help?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 17:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858788#M339310</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-14T17:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858817#M339315</link>
      <description>&lt;P&gt;After I get this counting, I will choose which variables to include in my analysis, and I will do entropy balancing&amp;nbsp;&lt;SPAN&gt;for matching treatment and control observations&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 19:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858817#M339315</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T19:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858820#M339316</link>
      <description>Yes I'm aware of that, so what I would like is the simpler one path version. What I really want is help in writng the macro that does this as I'm not familiar with macros. Basically what I want is to count the number of non missing observations, get the variable with the highest number of non missing observations, then remove all missing observations for this highest variable, then again count the number of non missing, get the variable with highest nonmiss, remove all obs with missing in this var and do this for all 50 vars.</description>
      <pubDate>Tue, 14 Feb 2023 20:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858820#M339316</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T20:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858822#M339317</link>
      <description>&lt;P&gt;Are you comfortable enough with macros to write a macro that will:&lt;/P&gt;
&lt;P&gt;1) Run PROC MEANS on a list of variables&lt;/P&gt;
&lt;P&gt;2) Identify the variable with highest number of non-missing variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I'm imagining:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro FindVarWithGreatestN(
  data=/*name of dataset*/
 ,list= /*space-delimited list of variables*/
  );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I would start by writing that macro.&amp;nbsp; Then after you have that, you can write an outer macro that would iterate, removing one variable at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't write that macro, can you make some test data, and write the non-macro SAS code you would use to do one iteration?&amp;nbsp; (I'm thinking it's PROC means to get N for each var, then select one variable with the max N (handling ties)).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This doesn't necessarily feel like the right thing to do, but if you want to learn the macro language it could be a useful exercise, so I'd be happy to help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 20:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858822#M339317</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-14T20:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858826#M339321</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173636"&gt;@Satori&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;After I get this counting, I will choose which variables to include in my analysis, and I will do entropy balancing&amp;nbsp;&lt;SPAN&gt;for matching treatment and control observations&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Okay, so you will choose variables based upon the pattern of missing values, rather than how good the predictors are? And are these values missing at random, or not missing at random?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 20:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858826#M339321</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-14T20:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858829#M339323</link>
      <description>Can you provide some sample data to work with? This is doable, probably inadvisable due to statistical methodology but doable. It also doesn't consider other combinations that may reduce your observations the minimum amount, as you need to consider all combos not just in order of highest to lowest.</description>
      <pubDate>Tue, 14 Feb 2023 20:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858829#M339323</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-14T20:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858830#M339324</link>
      <description>yes. Missing at random.</description>
      <pubDate>Tue, 14 Feb 2023 20:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858830#M339324</guid>
      <dc:creator>Satori</dc:creator>
      <dc:date>2023-02-14T20:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic counting of non missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858832#M339325</link>
      <description>&lt;P&gt;Look at PROC MI missing pattern report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/04/18/patterns-of-missing-data-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/04/18/patterns-of-missing-data-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, 14 Feb 2023 20:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dynamic-counting-of-non-missing-observations/m-p/858832#M339325</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-14T20:58:01Z</dc:date>
    </item>
  </channel>
</rss>

