<?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: format missing in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688605#M24615</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/322157"&gt;@urban58&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formats are great, but an alternative might be just to get the count of how many vars are populated like the below.&amp;nbsp; You can set the threshold any way you like, but just as an example, I set it to 2.&amp;nbsp; In other words, if two or more vars are populated, then you have data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pardon me if you already know this, but:&lt;/P&gt;
&lt;P&gt;I'm using a range to specify the vars.&amp;nbsp; It doesn't matter how many vars there are so long as they are all contiguous and all numeric.&amp;nbsp; All I have to do is specify the first and the last with two dashes in between.&amp;nbsp; If the vars are not all contiguous, I can specify groups of contiguous vars like this:&amp;nbsp; N(of A -- B&amp;nbsp; F -- T&amp;nbsp; V -- Z);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Results are shown below the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	Test_Data;
	INFILE	Datalines	MISSOVER;
	INPUT
	id BLANK ced abc def olp fft aaa_right fyu_right rst_right aaa_left fyu_left rst_left
	;
	
	IF	N(of id -- rst_left)	&amp;gt;	2	THEN
		I_Have_Data				=	1;
	ELSE
		I_Have_Data				=	0;

Datalines;
1
2 2 6 2 4 1 2.855 1.615 1.91 2.085 2.195 4.11
3 7 2 3 2 1 3.87 3.075 2.035 1.265 8.425 2.28
4 2 0 0 2.76 2.535 3.13 1.65 2.31 3.515
5 1
6 1 0 1 1 1 2.05 2.99 1.655 3.425 1.97 5.015
7 1 3 2 3 1 1.265 0.825 2.43 6.015 7.945 3.29
8
9 3 7 2 6 0 1.65 2.165 6.305 3.075 2.9
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1601665337470.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50138i7FA2BDD29326D9A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1601665337470.png" alt="jimbarbour_0-1601665337470.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Oct 2020 19:04:36 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2020-10-02T19:04:36Z</dc:date>
    <item>
      <title>format missing</title>
      <link>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688571#M24613</link>
      <description>&lt;P&gt;I have a numeric variable, BLANK, that is supposed to be missing if there is data for a particular TEST, otherwise BLANK should have a value why the test is not done. There are many times where BLANK is missing and there is no data for the test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A tiny fragment of my data - there are 100s of variables&lt;/P&gt;&lt;P&gt;id BLANK ced abc def olp fft aaa_right fyu_right rst_right aaa_left fyu_left rst_left&lt;BR /&gt;1&lt;BR /&gt;2 2 6 2 4 1 2.855 1.615 1.91 2.085 2.195 4.11&lt;BR /&gt;3 7 2 3 2 1 3.87 3.075 2.035 1.265 8.425 2.28&lt;BR /&gt;4 2 0 0 2.76 2.535 3.13 1.65 2.31 3.515&lt;BR /&gt;5 1&lt;BR /&gt;6 1 0 1 1 1 2.05 2.99 1.655 3.425 1.97 5.015&lt;BR /&gt;7 1 3 2 3 1 1.265 0.825 2.43 6.015 7.945 3.29&lt;BR /&gt;8&lt;BR /&gt;9 3 7 2 6 0 1.65 2.165 6.305 3.075 2.9&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;I have 2 questions I would like appreciate help with -&lt;BR /&gt;1. How can I format missing for the BLANK variable - I tried the format below with no success&lt;/P&gt;&lt;P&gt;value tt&lt;BR /&gt;. =0:Test done&lt;BR /&gt;1 =1:Refusal&lt;BR /&gt;2 =2:Split exam&lt;BR /&gt;3 =3:xxxx&lt;BR /&gt;4 =4:Proxy&lt;BR /&gt;5 =5:Other;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. To try and tease out why BLANK is missing and no test data, is it possible to combine BLANK with other variables (the test has questionnaire and physical test&lt;BR /&gt;components), both of which have a bunch of variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;missq =cmiss(of ced -- fft);&lt;BR /&gt;if missq=0 then QUEST_nd=0; else&lt;BR /&gt;if missq=(1:5) then QUEST_nd=1; else&lt;BR /&gt;if missq=5 then QUEST_nd=2; else;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if missp =cmiss(of aaa_right -- rst_left);&lt;BR /&gt;if missp =0 then PHY_nd=0; else&lt;BR /&gt;if missp=(1:5) then PHY_nd=1; else&lt;BR /&gt;if missp =6 then PHY_nd=2;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;How do I combine QUEST_nd/PHY_nd and BLANK to get a variable and format that I use to find out if I have test data or not?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;BR /&gt;Margaret&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 17:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688571#M24613</guid>
      <dc:creator>urban58</dc:creator>
      <dc:date>2020-10-02T17:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: format missing</title>
      <link>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688605#M24615</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/322157"&gt;@urban58&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formats are great, but an alternative might be just to get the count of how many vars are populated like the below.&amp;nbsp; You can set the threshold any way you like, but just as an example, I set it to 2.&amp;nbsp; In other words, if two or more vars are populated, then you have data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pardon me if you already know this, but:&lt;/P&gt;
&lt;P&gt;I'm using a range to specify the vars.&amp;nbsp; It doesn't matter how many vars there are so long as they are all contiguous and all numeric.&amp;nbsp; All I have to do is specify the first and the last with two dashes in between.&amp;nbsp; If the vars are not all contiguous, I can specify groups of contiguous vars like this:&amp;nbsp; N(of A -- B&amp;nbsp; F -- T&amp;nbsp; V -- Z);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Results are shown below the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	Test_Data;
	INFILE	Datalines	MISSOVER;
	INPUT
	id BLANK ced abc def olp fft aaa_right fyu_right rst_right aaa_left fyu_left rst_left
	;
	
	IF	N(of id -- rst_left)	&amp;gt;	2	THEN
		I_Have_Data				=	1;
	ELSE
		I_Have_Data				=	0;

Datalines;
1
2 2 6 2 4 1 2.855 1.615 1.91 2.085 2.195 4.11
3 7 2 3 2 1 3.87 3.075 2.035 1.265 8.425 2.28
4 2 0 0 2.76 2.535 3.13 1.65 2.31 3.515
5 1
6 1 0 1 1 1 2.05 2.99 1.655 3.425 1.97 5.015
7 1 3 2 3 1 1.265 0.825 2.43 6.015 7.945 3.29
8
9 3 7 2 6 0 1.65 2.165 6.305 3.075 2.9
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1601665337470.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50138i7FA2BDD29326D9A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1601665337470.png" alt="jimbarbour_0-1601665337470.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 19:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688605#M24615</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-02T19:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: format missing</title>
      <link>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688617#M24618</link>
      <description>&lt;P&gt;How exactly did you "test" your format.&lt;/P&gt;
&lt;P&gt;Admittedly I don't like skipping the quotes around value strings just in case. This will display the values as formatted:&lt;/P&gt;
&lt;PRE&gt;proc format ;

value tt
. ="0:Test done"
1 ="1:Refusal"
2 ="2:Split exam"
3 ="3:xxxx"
4 ="4:Proxy"
5 ="5:Other"
;
run;

data example;
   do value=.,1 to 5 ;
   output;
   end;
run;

proc print data=example;
   var value;
   format value tt.;
run;
&lt;/PRE&gt;
&lt;P&gt;If use a procedure like Proc Freq looking to see how many of each there are including the formatted value for the missing you need to include the option /missing on a tables statement.&lt;/P&gt;
&lt;P&gt;You do have to make sure the format is available in the current session as well.&lt;/P&gt;
&lt;P&gt;&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/322157"&gt;@urban58&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. To try and tease out why BLANK is missing and no test data, is it possible to combine BLANK with other variables (the test has questionnaire and physical test&lt;BR /&gt;components), both of which have a bunch of variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;missq =cmiss(of ced -- fft);&lt;BR /&gt;if missq=0 then QUEST_nd=0; else&lt;BR /&gt;if missq=(1:5) then QUEST_nd=1; else&lt;BR /&gt;if missq=5 then QUEST_nd=2; else;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;if missp =cmiss(of aaa_right -- rst_left);&lt;BR /&gt;if missp =0 then PHY_nd=0; else&lt;BR /&gt;if missp=(1:5) then PHY_nd=1; else&lt;BR /&gt;if missp =6 then PHY_nd=2;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;How do I combine QUEST_nd/PHY_nd and BLANK to get a variable and format that I use to find out if I have test data or not?&lt;/P&gt;
&lt;P&gt;Thanks in advance,&lt;BR /&gt;Margaret&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think that need to provide an example with values and what you expect/want this snippet to tell you. Since the&lt;/P&gt;
&lt;P&gt;if missq=(1:5)&lt;/P&gt;
&lt;P&gt;throws errors, I am going to guess that you intend to use the IN operator to check if MISSQ is one of the integer values 1 through 5 as:&lt;/P&gt;
&lt;P&gt;if missq in (1:5)&lt;/P&gt;
&lt;P&gt;But that would be true for missg=5 so in attempting&lt;/P&gt;
&lt;P&gt;if missq in (1:5) then QUEST_nd=1; else&lt;BR /&gt;if missq=5 then QUEST_nd=2&amp;nbsp; &amp;lt;= would never happen because it was set to 1 before the else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 20:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/format-missing/m-p/688617#M24618</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-02T20:12:14Z</dc:date>
    </item>
  </channel>
</rss>

