<?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 FollowUp with Reeza on How to get a count of missing and nonmissing entries in sparse dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739297#M230718</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to follow up on the code solution that you provided earlier on this question.&amp;nbsp; I am still trying to step through the why it works.&amp;nbsp; But I did run into problem.&amp;nbsp; I decided to go the overkill route and made it this far&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data OPERA.OPERA_All_2;
        call streaminit(45);
		length obs 8.;
		array vars(*) $3. DLEAdi DMHDdi DCOMdi DEARdi DEYEdi DDRSdi DOUTdi DREMdi DPHYdi;

		do obs= 1 to 200; *181308;

		         do i=1 to dim(vars);
				         vars(i)= put(rand('table', 0.4, 0.4, 0.2), Z3.);
						 if vars(i) = '003' then call missing(vars(i));
				 end;
				 output;
		end;
		drop i;
run;

*set input data set  name;
%let INPUT_DSN = OPERA.OPERA_All_2;
%let OUTPUT_DSN = OPERA.OPERA_All_2A;
* 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 sdo not get too messy;

proc freq data=&amp;amp;INPUT_DSN.;
    table _all_ / missing;
	format _numeric_ nmissfmt. _character_ $missfmt.;
run;

ods select all;
* Format output;   

Data OPERA.OPERA_ALL_2_A;
   length Variable $32.  Variable_Value  $50.;
   set OPERA.OPERA_ALL_2;
   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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then I ran into this error in the log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
NOTE: Argument to function VVALUEX is not a valid variable name:  .
NOTE: Argument to function VVALUEX is not a valid variable name:  .
NOTE: Argument to function VVALUEX is not a valid variable name:  .
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      200 at 274:57
NOTE: There were 200 observations read from the data set OPERA.OPERA_ALL_2.
NOTE: The data set OPERA.OPERA_ALL_2_A has 200 observations and 4 variables.
NOTE: Compressing data set OPERA.OPERA_ALL_2_A increased size by 100.00 percent.
      Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


278  proc sort Data = OPERA.OPERA_ALL_2;
279     by Variable;
ERROR: Variable VARIABLE not found.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log window filled up with the Note:&amp;nbsp; Argument to function VValueX .......&lt;/P&gt;
&lt;P&gt;I have 181,000 obs so I pared it down to 200 just for testing.&amp;nbsp; I still ran into the note in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the first section of code,&lt;/P&gt;
&lt;P&gt;Also I tried to explore with formats how I can substitute the text 'No' 'Yes' or 'Missing' for the '001', '002', '003' variables (which I couldn't pull off) but then noticed that the '001' etc didn't match up with the actual occurrence of the character values in the dataset.&amp;nbsp; That is, if '001' = No&amp;nbsp; and '002' = Yes&amp;nbsp; and '003' = missing&amp;nbsp; that they weren't aligning with the actual data.&amp;nbsp; That is if the dataset had in row 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No&amp;nbsp; &amp;nbsp; No&amp;nbsp;&amp;nbsp;&amp;nbsp; No&amp;nbsp;&amp;nbsp;&amp;nbsp; Yes&amp;nbsp; &amp;nbsp;&amp;nbsp; .&amp;nbsp; &amp;nbsp;&amp;nbsp; No &amp;nbsp;&amp;nbsp; No&lt;/P&gt;
&lt;P&gt;that the var codes might be&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 001&amp;nbsp; 002&amp;nbsp;&amp;nbsp; 001&amp;nbsp;&amp;nbsp; 003&amp;nbsp;&amp;nbsp; 002&amp;nbsp; 002&amp;nbsp;&amp;nbsp; 001&lt;/P&gt;
&lt;P&gt;(that is hypothetical example but it illustrates the issue). And it might be my lack of connecting the pieces of the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your initial help, and I hope that you can guide me through this.&amp;nbsp; I use some of your code solutions for months and they work like a charm.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wklierman&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 May 2021 18:01:03 GMT</pubDate>
    <dc:creator>wlierman</dc:creator>
    <dc:date>2021-05-05T18:01:03Z</dc:date>
    <item>
      <title>FollowUp with Reeza on How to get a count of missing and nonmissing entries in sparse dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739297#M230718</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to follow up on the code solution that you provided earlier on this question.&amp;nbsp; I am still trying to step through the why it works.&amp;nbsp; But I did run into problem.&amp;nbsp; I decided to go the overkill route and made it this far&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data OPERA.OPERA_All_2;
        call streaminit(45);
		length obs 8.;
		array vars(*) $3. DLEAdi DMHDdi DCOMdi DEARdi DEYEdi DDRSdi DOUTdi DREMdi DPHYdi;

		do obs= 1 to 200; *181308;

		         do i=1 to dim(vars);
				         vars(i)= put(rand('table', 0.4, 0.4, 0.2), Z3.);
						 if vars(i) = '003' then call missing(vars(i));
				 end;
				 output;
		end;
		drop i;
run;

*set input data set  name;
%let INPUT_DSN = OPERA.OPERA_All_2;
%let OUTPUT_DSN = OPERA.OPERA_All_2A;
* 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 sdo not get too messy;

proc freq data=&amp;amp;INPUT_DSN.;
    table _all_ / missing;
	format _numeric_ nmissfmt. _character_ $missfmt.;
run;

ods select all;
* Format output;   

Data OPERA.OPERA_ALL_2_A;
   length Variable $32.  Variable_Value  $50.;
   set OPERA.OPERA_ALL_2;
   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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then I ran into this error in the log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
NOTE: Argument to function VVALUEX is not a valid variable name:  .
NOTE: Argument to function VVALUEX is not a valid variable name:  .
NOTE: Argument to function VVALUEX is not a valid variable name:  .
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      200 at 274:57
NOTE: There were 200 observations read from the data set OPERA.OPERA_ALL_2.
NOTE: The data set OPERA.OPERA_ALL_2_A has 200 observations and 4 variables.
NOTE: Compressing data set OPERA.OPERA_ALL_2_A increased size by 100.00 percent.
      Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


278  proc sort Data = OPERA.OPERA_ALL_2;
279     by Variable;
ERROR: Variable VARIABLE not found.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log window filled up with the Note:&amp;nbsp; Argument to function VValueX .......&lt;/P&gt;
&lt;P&gt;I have 181,000 obs so I pared it down to 200 just for testing.&amp;nbsp; I still ran into the note in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the first section of code,&lt;/P&gt;
&lt;P&gt;Also I tried to explore with formats how I can substitute the text 'No' 'Yes' or 'Missing' for the '001', '002', '003' variables (which I couldn't pull off) but then noticed that the '001' etc didn't match up with the actual occurrence of the character values in the dataset.&amp;nbsp; That is, if '001' = No&amp;nbsp; and '002' = Yes&amp;nbsp; and '003' = missing&amp;nbsp; that they weren't aligning with the actual data.&amp;nbsp; That is if the dataset had in row 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No&amp;nbsp; &amp;nbsp; No&amp;nbsp;&amp;nbsp;&amp;nbsp; No&amp;nbsp;&amp;nbsp;&amp;nbsp; Yes&amp;nbsp; &amp;nbsp;&amp;nbsp; .&amp;nbsp; &amp;nbsp;&amp;nbsp; No &amp;nbsp;&amp;nbsp; No&lt;/P&gt;
&lt;P&gt;that the var codes might be&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 001&amp;nbsp; 002&amp;nbsp;&amp;nbsp; 001&amp;nbsp;&amp;nbsp; 003&amp;nbsp;&amp;nbsp; 002&amp;nbsp; 002&amp;nbsp;&amp;nbsp; 001&lt;/P&gt;
&lt;P&gt;(that is hypothetical example but it illustrates the issue). And it might be my lack of connecting the pieces of the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your initial help, and I hope that you can guide me through this.&amp;nbsp; I use some of your code solutions for months and they work like a charm.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wklierman&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 18:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739297#M230718</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2021-05-05T18:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: FollowUp with Reeza on How to get a count of missing and nonmissing entries in sparse dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739300#M230721</link>
      <description>&lt;P&gt;You left something out somewhere.&lt;/P&gt;
&lt;P&gt;Your current code is not generating any output from PROC FREQ.&lt;/P&gt;
&lt;P&gt;Did you forget the ODS OUTPUT statement?&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 18:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739300#M230721</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-05T18:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: FollowUp with Reeza on How to get a count of missing and nonmissing entries in sparse dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739301#M230722</link>
      <description>&lt;P&gt;You are using variables that are not in the input dataset:&lt;/P&gt;
&lt;PRE&gt; 89         Data myfold.OPERA_ALL_2_A;
 90            length Variable $32.  Variable_Value  $50.;
 91            set myfold.OPERA_ALL_2;
 92            Variable=scan(table, 2);
 93            Variable_Value=strip(trim(vvaluex(variable)));
 94            presentation = catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
 95            keep Variable Variable_Value frequency percent cum: presentation;
 96            label Variable='Variable' Variable_Value='Variable_Value';
 97         run;
 
 NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
       92:18   
 NOTE: Variable table is uninitialized.
 NOTE: Variable frequency is uninitialized.
 NOTE: Variable percent is uninitialized.
 WARNING: The variable cum: in the DROP, KEEP, or RENAME list has never been referenced.
 NOTE: Argument to function VVALUEX is not a valid variable name:  .
&lt;/PRE&gt;
&lt;P&gt;Since table is not there, a SCAN() from it will create an empty string, which can't be used as argument for the VVALUEX() function.&lt;/P&gt;
&lt;P&gt;I guess you missed to use ODS OUTPUT to create a dataset from the FREQ output, to use that as input in this data step.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 18:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739301#M230722</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-05T18:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: FollowUp with Reeza on How to get a count of missing and nonmissing entries in sparse dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739306#M230724</link>
      <description>&lt;P&gt;You are right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did forget the proc freq step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 18:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739306#M230724</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2021-05-05T18:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: FollowUp with Reeza on How to get a count of missing and nonmissing entries in sparse dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739307#M230725</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did forget the proc freq step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 18:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FollowUp-with-Reeza-on-How-to-get-a-count-of-missing-and/m-p/739307#M230725</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2021-05-05T18:37:05Z</dc:date>
    </item>
  </channel>
</rss>

