<?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 Reset special numeric missing values to original value to output/export in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971362#M377299</link>
    <description>&lt;P&gt;I used the following code to format my data for cleaning:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc format;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let mis_inval='777'=.a '888'=.b;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let mis_val=.a='Dont Know' .b='Refused';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let mis_valstr='777'='Dont Know' '888'='Refused';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;invalue demo2_ &amp;amp;mis_inval other = [best32.];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;value demo2_ 1='Yes' 0='No'&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;mis_val;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;data test;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;set test;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;informat demo2 demo2_.;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;format demo2 demo2_.;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'd like to export the new dataset (with new variables I have created but not showing here) but with the original values (777 or 888), not the special numeric missing variables. It always exports as B or A. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Wed, 23 Jul 2025 02:13:27 GMT</pubDate>
    <dc:creator>mmmb</dc:creator>
    <dc:date>2025-07-23T02:13:27Z</dc:date>
    <item>
      <title>Reset special numeric missing values to original value to output/export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971362#M377299</link>
      <description>&lt;P&gt;I used the following code to format my data for cleaning:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc format;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let mis_inval='777'=.a '888'=.b;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let mis_val=.a='Dont Know' .b='Refused';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let mis_valstr='777'='Dont Know' '888'='Refused';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;invalue demo2_ &amp;amp;mis_inval other = [best32.];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;value demo2_ 1='Yes' 0='No'&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;mis_val;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;data test;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;set test;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;informat demo2 demo2_.;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;format demo2 demo2_.;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'd like to export the new dataset (with new variables I have created but not showing here) but with the original values (777 or 888), not the special numeric missing variables. It always exports as B or A. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Jul 2025 02:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971362#M377299</guid>
      <dc:creator>mmmb</dc:creator>
      <dc:date>2025-07-23T02:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reset special numeric missing values to original value to output/export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971364#M377300</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Replace the %let-statements as they are not necessary at all.&lt;/LI&gt;
&lt;LI&gt;Don't overwrite "test" with the data step.&lt;/LI&gt;
&lt;LI&gt;The informat-statement changes the informat attribute of a variable and has no effect, unless the variable is used in an input statement.&lt;/LI&gt;
&lt;LI&gt;A format changes the appearance of a value, not the value itself. so maybe removing the assigned format solves the issue.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 23 Jul 2025 05:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971364#M377300</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-07-23T05:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reset special numeric missing values to original value to output/export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971372#M377302</link>
      <description>&lt;P&gt;What do you mean by the word "export"?&amp;nbsp; Did you convert the SAS dataset into something else? What? How?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you PRINT the values the FORMAT will determine how the values are displayed.&amp;nbsp; So you can "export" your data to an XLSX sheet by using ODS EXCEL and PROC PRINT (or PROC REPORT).&amp;nbsp; If you want a format that will display .A as 777 and normal numbers as expected then you probably want something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  value miss2num .a='777' .b='888' other=[best12.];
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data step does not make much sense to me either.&amp;nbsp; Why bother to attach the informat when you are not using an INPUT statement to assign new values to the variable?&amp;nbsp; Is it just to provide documentation of how you transformed the special valid numeric values like 777 into special missing values instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to actually transform .A back into 777 then you cannot do it directly using formats or informats.&amp;nbsp; That is because FORMATS convert values into text and INFORMATS convert text into values.&amp;nbsp; Numeric formats and informats work with numeric values.&amp;nbsp; Character formats and informats work with character values. So neither formats nor informats can be used to convert numeric values directly into other numeric values.&amp;nbsp; Instead you would need to use a combination of both PUT() and and INPUT() function calls.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this step will make a new variable called DEMO2_RAW that will have the original numeric values of 777 and 888 instead of the special missing values of .A and .B.&amp;nbsp; It uses the MISS2NUM. format to convert the .A into "777" and then uses the 32. informat to convert that string of digits back into a number.&amp;nbsp; You can use format/informat statement with variables but no format specification to remove any formats that might have been attached so the actual values will display.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test_recoded;
  set test;
  demo2_raw = input(put(demo2,miss2num.),32.);
  informat demo2 demo2_raw ;
  format demo2 demo2_raw ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 13:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reset-special-numeric-missing-values-to-original-value-to-output/m-p/971372#M377302</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-07-23T13:01:20Z</dc:date>
    </item>
  </channel>
</rss>

