<?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: Compress a numeric &amp;quot;.&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681599#M206185</link>
    <description>&lt;P&gt;How a missing value is rendered in output is controlled with the system option MISSING.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can examine the current setting of the option by looking in the LOG&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc options option=MISSING;
run;&lt;/PRE&gt;
&lt;P&gt;Log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;133  proc options option=missing;
134  run;

    SAS (r) Proprietary Software Release 9.4  TS1M6

 MISSING=.         Specifies the character to print for missing numeric values.
NOTE: PROCEDURE OPTIONS used (Total process time):
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The option allows you to specify the&amp;nbsp;&lt;U&gt;single&lt;/U&gt; character to use.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  input x @@; datalines;
0 1 .
;

options missing = . nosource;

proc options option=missing;
run;

data _null_;
  set have;
  result = cats (x);
  put 'NOTE:' x= result=;
run;

options missing = 0;   * Show missing values as 0 instead of default .;

data _null_;
  set have;
  result = cats (x);
  put 'NOTE:' x= result=;
run;

options missing = !;  * Show missing values as exclamation point (!);

data _null_;
  set have;
  result = cats (x);
  put 'NOTE:' x= result=;
run;

options missing = . source;&lt;/PRE&gt;
&lt;P&gt;Log (the X= value is the missing value rendering, and the RESULT= value is the rendered missing stored in a variable)&lt;/P&gt;
&lt;PRE&gt;    SAS (r) Proprietary Software Release 9.4  TS1M6

 MISSING=.         Specifies the character to print for missing numeric values.
NOTE: PROCEDURE OPTIONS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



NOTE:x=0 result=0
NOTE:x=1 result=1
NOTE:x=. result=.        &amp;lt;---------------
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



NOTE:x=0 result=0
NOTE:x=1 result=1
NOTE:x=0 result=0         &amp;lt;---------------
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



NOTE:x=0 result=0
NOTE:x=1 result=1
NOTE:x=! result=!         &amp;lt;---------------
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Sep 2020 12:01:31 GMT</pubDate>
    <dc:creator>RichardDeVen</dc:creator>
    <dc:date>2020-09-04T12:01:31Z</dc:date>
    <item>
      <title>Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681587#M206179</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a numeric variable taking the values 0,1 and "." . When using the function compress or cats for this variable, the "." is tranformed into a 0. Is there any way to avoid this aside from transforming the numeric variable into a character variable taking the value "0" , "1" and ".".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 10:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681587#M206179</guid>
      <dc:creator>Mathis1</dc:creator>
      <dc:date>2020-09-04T10:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681590#M206180</link>
      <description>&lt;P&gt;The COMPRESS() function operates on character strings. Why would you ever use it on a numeric value?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 11:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681590#M206180</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-04T11:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681593#M206182</link>
      <description>&lt;P&gt;CATS and COMPRESS are &lt;EM&gt;character&lt;/EM&gt; functions, which do not work well with &lt;EM&gt;numeric&lt;/EM&gt; variables.&lt;/P&gt;
&lt;P&gt;A missing value in SAS is, per default, represented as a dot. You can change how SAS &lt;EM&gt;displays&lt;/EM&gt; a missing value with the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=n0qamf3yfjtwzhn1ran6xwblnlea.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;MISSING=&lt;/A&gt; system option. If you get a 0 instead of the dot when using the implicit conversion from numeric to character, then most likely your MISSING option is set to a zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For detailed help, post your code and log, and some example data. Please post your example data as a data step with datalines, so it is easy for us to recreate your dataset in our environment.&lt;/P&gt;
&lt;P&gt;Use this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/2FD96521DCF95C42FE57BF2A7CB72678/responsive_peak/images/image_not_found.png" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;for posting logs (and other textual data that must be kept as-is), and the "little running man" right next to it for SAS code.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 11:15:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681593#M206182</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-04T11:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681599#M206185</link>
      <description>&lt;P&gt;How a missing value is rendered in output is controlled with the system option MISSING.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can examine the current setting of the option by looking in the LOG&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc options option=MISSING;
run;&lt;/PRE&gt;
&lt;P&gt;Log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;133  proc options option=missing;
134  run;

    SAS (r) Proprietary Software Release 9.4  TS1M6

 MISSING=.         Specifies the character to print for missing numeric values.
NOTE: PROCEDURE OPTIONS used (Total process time):
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The option allows you to specify the&amp;nbsp;&lt;U&gt;single&lt;/U&gt; character to use.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  input x @@; datalines;
0 1 .
;

options missing = . nosource;

proc options option=missing;
run;

data _null_;
  set have;
  result = cats (x);
  put 'NOTE:' x= result=;
run;

options missing = 0;   * Show missing values as 0 instead of default .;

data _null_;
  set have;
  result = cats (x);
  put 'NOTE:' x= result=;
run;

options missing = !;  * Show missing values as exclamation point (!);

data _null_;
  set have;
  result = cats (x);
  put 'NOTE:' x= result=;
run;

options missing = . source;&lt;/PRE&gt;
&lt;P&gt;Log (the X= value is the missing value rendering, and the RESULT= value is the rendered missing stored in a variable)&lt;/P&gt;
&lt;PRE&gt;    SAS (r) Proprietary Software Release 9.4  TS1M6

 MISSING=.         Specifies the character to print for missing numeric values.
NOTE: PROCEDURE OPTIONS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



NOTE:x=0 result=0
NOTE:x=1 result=1
NOTE:x=. result=.        &amp;lt;---------------
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



NOTE:x=0 result=0
NOTE:x=1 result=1
NOTE:x=0 result=0         &amp;lt;---------------
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



NOTE:x=0 result=0
NOTE:x=1 result=1
NOTE:x=! result=!         &amp;lt;---------------
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 12:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681599#M206185</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-09-04T12:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681670#M206207</link>
      <description>&lt;P&gt;Large economy sized hint:&lt;/P&gt;
&lt;P&gt;Provide some example data and how you want the output to appear.&lt;/P&gt;
&lt;P&gt;Since you mention CATS function then that seems to imply that you have multiple variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a start of data set with 3 variables and all combinations of ., 0, and 1.&lt;/P&gt;
&lt;PRE&gt;data have;
   input v1 v2 v3;
datalines;
. . .                                                           
. . 0                                                           
. . 1                                                           
. 0 .                                                           
. 0 0                                                           
. 0 1                                                           
. 1 .                                                           
. 1 0                                                           
. 1 1                                                           
0 . .                                                           
0 . 0                                                           
0 . 1                                                           
0 0 .                                                           
0 0 0                                                           
0 0 1                                                           
0 1 .                                                           
0 1 0                                                           
0 1 1                                                           
1 . .                                                           
1 . 0                                                           
1 . 1                                                           
1 0 .                                                           
1 0 0                                                           
1 0 1                                                           
1 1 .                                                           
1 1 0                                                           
1 1 1  &lt;BR /&gt;;
 &lt;/PRE&gt;
&lt;P&gt;So now you just have to show what the result should be. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 15:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/681670#M206207</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-04T15:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/682012#M206403</link>
      <description>Hi,&lt;BR /&gt;If I take your example ballardw, I would like to create a new variable V4 for which the first line would be :&lt;BR /&gt;V1      V2          V3            V4&lt;BR /&gt;.          .             .               ._._.   &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Where "_" is the delimiter&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Sep 2020 13:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/682012#M206403</guid>
      <dc:creator>Mathis1</dc:creator>
      <dc:date>2020-09-07T13:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Compress a numeric "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/682016#M206407</link>
      <description>&lt;P&gt;The CATX() function should so that. Make sure the missing option is set to '.' and not something else, like '0' or ' '.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let missing=%sysfunc(getoption(missing));
options missing='.';
data have;
 do v1=.,0,1; do v2=.,0,1; do v3=.,0,1;
   v4 = catx('_',of v1-v3);
   output;
 end;end;end;
run;
options missing="&amp;amp;missing";

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    v1    v2    v3     v4

  1     .     .     .    ._._.
  2     .     .     0    ._._0
  3     .     .     1    ._._1
  4     .     0     .    ._0_.
  5     .     0     0    ._0_0
  6     .     0     1    ._0_1
  7     .     1     .    ._1_.
  8     .     1     0    ._1_0
  9     .     1     1    ._1_1
 10     0     .     .    0_._.
 11     0     .     0    0_._0
 12     0     .     1    0_._1
 13     0     0     .    0_0_.
 14     0     0     0    0_0_0
 15     0     0     1    0_0_1
 16     0     1     .    0_1_.
 17     0     1     0    0_1_0
 18     0     1     1    0_1_1
 19     1     .     .    1_._.
 20     1     .     0    1_._0
 21     1     .     1    1_._1
 22     1     0     .    1_0_.
 23     1     0     0    1_0_0
 24     1     0     1    1_0_1
 25     1     1     .    1_1_.
 26     1     1     0    1_1_0
 27     1     1     1    1_1_1&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Sep 2020 13:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-a-numeric-quot-quot/m-p/682016#M206407</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-07T13:35:00Z</dc:date>
    </item>
  </channel>
</rss>

