<?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: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956501#M373500</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465029"&gt;@CBF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to take stock of the extent of missingness over multiple years for multiple subsets of variables. So, I've been working on a macro to automate this. There is a problem in my code (in blue) where I try to generate a variable that is a count of missings for each row. The counts in the resulting variable are incorrect.&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;,,,,&lt;/P&gt;
&lt;P&gt;However, I want to be able to run this for different subsets that have different starting and ending variables. At this point, I could have just copied and pasted the code 800 times with that small edit, but I am being stubborn. All suggestions very appreciated!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;AS&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;has pointed out, you have to be sure not to mistakenly include the newly created variables in the CMISS function (which would happen using NMISS=CMISS(of _ALL_).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to deal with this is to generate two SENTINEL variables, one immediately to the left of your var list, and one immediately to the right.&amp;nbsp; Then use then as list boundaries in the expression&amp;nbsp; _&lt;EM&gt;&lt;STRONG&gt;left_sentinel -- _right_sentinel&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_:);
  retain _left_sentinel .;
  set mydata;
  retain _right_sentinel .;

  if _n_=1 then do;
    call missing(of _all_);
    nvars=cmiss(of _left_sentinel -- _right_sentinel)-2;
    set mydata;  /*Repopulate the variables */
    _left_sentinel=1;
    _right_sentinel=1;
  end;
  retain nvars;
  nmiss= cmiss(of _left_sentinel -- _right_sentinel);
  pct_miss=nmiss/nvars;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The point is, don't identify any new variables until after _right_sentinel has been named.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 18 Jan 2025 05:49:11 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2025-01-18T05:49:11Z</dc:date>
    <item>
      <title>CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956490#M373496</link>
      <description>&lt;P&gt;I am trying to take stock of the extent of missingness over multiple years for multiple subsets of variables. So, I've been working on a macro to automate this. There is a problem in my code (in blue) where I try to generate a variable that is a count of missings for each row. The counts in the resulting variable are incorrect.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%LET STEST2 = VAR1 VAR2 VAR3... VAR35 /* &amp;amp;SVARS */
/* LISTN (LISTNAME) = TEST */ 

%MACRO PERCENTCOMPLETE(YEARS,SVARS,LISTN);

    %LET COUNT = %SYSFUNC(COUNTW(&amp;amp;YEARS));
    %DO I = 1 %TO &amp;amp;COUNT;
        %LET YEAR = %SCAN(&amp;amp;YEARS, &amp;amp;I);

	%PUT YEAR = &amp;amp;YEAR LISTN = &amp;amp;LISTN SVARS = &amp;amp;SVARS;

	DATA WORK.SVARS&amp;amp;YEAR&amp;amp;LISTN;
	    SET S2&amp;amp;YEAR;
		KEEP &amp;amp;SVARS ;
	RUN ;

	DATA WORK.MODELVARS&amp;amp;YEAR&amp;amp;LISTN;
		SET	SVARS&amp;amp;YEAR&amp;amp;LISTN;
		ARRAY VARS {*} _NUMERIC_ ; 
		NUM_VAR&amp;amp;YEAR&amp;amp;LISTN = DIM(VARS); 
	RUN ;

	DATA PERCOM&amp;amp;YEAR&amp;amp;LISTN ;
		SET MODELVARS&amp;amp;YEAR&amp;amp;LISTN ;
		
		&lt;FONT color="#3366FF"&gt;MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN = CMISS(OF _ALL_);&lt;/FONT&gt;			&lt;BR /&gt;                MISSPER&amp;amp;YEAR&amp;amp;LISTN = MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN/NUM_VAR&amp;amp;YEAR&amp;amp;LISTN;

		LENGTH COMOBS&amp;amp;YEAR&amp;amp;LISTN 3. ;	
		COMOBS&amp;amp;YEAR&amp;amp;LISTN = 0 ; 
		IF MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN = 0 THEN COMOBS&amp;amp;YEAR&amp;amp;LISTN = 1 ;

		LENGTH EMPOBS&amp;amp;YEAR&amp;amp;LISTN 3.; 
		EMPOBS&amp;amp;YEAR&amp;amp;LISTN = 0 ;
		IF MISSPER&amp;amp;YEAR&amp;amp;LISTN = 1 THEN EMPOBS&amp;amp;YEAR&amp;amp;LISTN = 1 ;
	RUN ;
	%END;	

%MEND ;

%PERCENTCOMPLETE(2017 2018 2019 2020 2021 2022 2023, &amp;amp;STEST2, TEST);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I know that I can use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;FONT color="#3366FF"&gt;MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN = CMISS(OF VAR1 -- VAR35);&lt;/FONT&gt;&lt;/CODE&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I want to be able to run this for different subsets that have different starting and ending variables. At this point, I could have just copied and pasted the code 800 times with that small edit, but I am being stubborn. All suggestions very appreciated!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 22:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956490#M373496</guid>
      <dc:creator>CBF</dc:creator>
      <dc:date>2025-01-17T22:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956492#M373497</link>
      <description>&lt;P&gt;You need to initialise all the variables you create before you use &lt;CODE class=" language-sas"&gt;CMISS()&lt;/CODE&gt;, like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN = 0;&lt;BR /&gt;...
MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN = CMISS(OF _ALL_);		&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could just use a retain statement&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;retain &lt;CODE class=" language-sas"&gt;MISSCOUNT&amp;amp;YEAR&amp;amp;LISTN&lt;/CODE&gt; &lt;BR /&gt;MISSPER&amp;amp;YEAR&amp;amp;LISTN &lt;BR /&gt;EMPOBS&amp;amp;YEAR&amp;amp;LISTN &amp;lt;more variables&amp;gt; 0; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;LENGTH EMPOBS&amp;amp;YEAR&amp;amp;LISTN 3.; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is incorrect. Do not use a format in a &lt;CODE class=""&gt;LENGTH&lt;/CODE&gt; statement. Write:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;length EMPOBS&amp;amp;YEAR&amp;amp;LISTN 3; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2025 02:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956492#M373497</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2025-01-18T02:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956495#M373498</link>
      <description>Are you just trying to generate the percent missing by variable / year?  (Given a specific set of variables and years)</description>
      <pubDate>Sat, 18 Jan 2025 01:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956495#M373498</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-01-18T01:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956499#M373499</link>
      <description>No. I have a different macro for that. I am generating the percentage of observations that have complete data (no missings) for a given set of variables.&lt;BR /&gt;&lt;BR /&gt;I am going to be using factor scores based on survey scores as dependent variables. In the past, when I’ve used them as covariates, I have done some imputation to retain observations with missing values. Now I am looking to revisit my measurement framework, and without imputing, I need to balance the inclusion of more variables with the loss of observations. So, I am running these percentages on various combinations of variables, and I have seven years of data.&lt;BR /&gt;</description>
      <pubDate>Sat, 18 Jan 2025 02:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956499#M373499</guid>
      <dc:creator>CBF</dc:creator>
      <dc:date>2025-01-18T02:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956501#M373500</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/465029"&gt;@CBF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to take stock of the extent of missingness over multiple years for multiple subsets of variables. So, I've been working on a macro to automate this. There is a problem in my code (in blue) where I try to generate a variable that is a count of missings for each row. The counts in the resulting variable are incorrect.&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;,,,,&lt;/P&gt;
&lt;P&gt;However, I want to be able to run this for different subsets that have different starting and ending variables. At this point, I could have just copied and pasted the code 800 times with that small edit, but I am being stubborn. All suggestions very appreciated!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;AS&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;has pointed out, you have to be sure not to mistakenly include the newly created variables in the CMISS function (which would happen using NMISS=CMISS(of _ALL_).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to deal with this is to generate two SENTINEL variables, one immediately to the left of your var list, and one immediately to the right.&amp;nbsp; Then use then as list boundaries in the expression&amp;nbsp; _&lt;EM&gt;&lt;STRONG&gt;left_sentinel -- _right_sentinel&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_:);
  retain _left_sentinel .;
  set mydata;
  retain _right_sentinel .;

  if _n_=1 then do;
    call missing(of _all_);
    nvars=cmiss(of _left_sentinel -- _right_sentinel)-2;
    set mydata;  /*Repopulate the variables */
    _left_sentinel=1;
    _right_sentinel=1;
  end;
  retain nvars;
  nmiss= cmiss(of _left_sentinel -- _right_sentinel);
  pct_miss=nmiss/nvars;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The point is, don't identify any new variables until after _right_sentinel has been named.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2025 05:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956501#M373500</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2025-01-18T05:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956504#M373503</link>
      <description>That would be better to clarify your question if you could post some data and desired output.</description>
      <pubDate>Sat, 18 Jan 2025 06:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956504#M373503</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-18T06:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956508#M373504</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I am going to be using factor scores based on survey scores as dependent variables. In the past, when I’ve used them as covariates, I have done some imputation to retain observations with missing values. Now I am looking to revisit my measurement framework, and without imputing, I need to balance the inclusion of more variables with the loss of observations. So, I am running these percentages on various combinations of variables, and I have seven years of data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;You might want to consider that&amp;nbsp;SAS does have methods to handle this issue of different numbers of missings in different observations. And then all these complications of writing macros and counting the number of missings is unnecessary.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In particular, PROC PLS has a very sophisticated approach. Even if you don't want a PLS model, you want some other sort of model, this method will fill in the missings according to the EM algorithm, and you can work with this new data set that has no missings in whatever model you want.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_details09.htm" target="_self"&gt;PROC PLS documentation&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;However, the&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;option in the&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm" target="_blank" rel="noopener"&gt;PROC PLS&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;statement provides more sophisticated ways of modeling in the presence of missing values. If you specify&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;AVG or&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;EM, then all observations in the input data set contribute to both the analysis and the&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax07.htm" target="_blank" rel="noopener"&gt;OUTPUT OUT=&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;data set. With&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;AVG, the fit is computed by filling in missing values with the average of the nonmissing values for the corresponding variable. With&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;EM, the procedure first computes the model with&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;AVG, then fills in missing values with their predicted values based on that model and computes the model again. Alternatively, you can specify&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_pls_syntax01.htm#statug.pls.pls_prc_missingopt" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt;&lt;SPAN&gt;EM(MAXITER=&lt;/SPAN&gt;&lt;SPAN class=" aa-argument"&gt;n&lt;/SPAN&gt;&lt;SPAN&gt;) with a large value of&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=" aa-argument"&gt;n&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;in order to perform this imputation/fit loop until convergence.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sat, 18 Jan 2025 08:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956508#M373504</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-18T08:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956567#M373505</link>
      <description>&lt;P&gt;Aren't you making this more complicated than it needs to be?&lt;/P&gt;
&lt;P&gt;You seem to already have the list of variable names:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET STEST2 = VAR1-VAR3 VAR35 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So use the OF keyword so you can use that macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  nmiss = cmiss(of &amp;amp;stest2);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jan 2025 03:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956567#M373505</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-19T03:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956578#M373510</link>
      <description>&lt;P&gt;Are you just having a hard time counting how many variables are in a variable list like FIRSTVAR -- LASTVAR ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one trick you could use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have(obs=0) out=names;
  var &amp;amp;svars;
run;
proc sql noprint;
   select count(*) format=32. into :numvars trimmed from names;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jan 2025 16:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956578#M373510</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-19T16:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: CREATING A VARIABLE THAT IS A COUNT OF MISSING VALUES IN A ROW WITHIN A MACRO</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956934#M373602</link>
      <description>&lt;P&gt;Thank you. I tried this approach but omitted "OF." Appreciate it!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 23:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CREATING-A-VARIABLE-THAT-IS-A-COUNT-OF-MISSING-VALUES-IN-A-ROW/m-p/956934#M373602</guid>
      <dc:creator>CBF</dc:creator>
      <dc:date>2025-01-22T23:05:35Z</dc:date>
    </item>
  </channel>
</rss>

