<?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: Replace &amp;quot;.&amp;quot; with blanks in a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898591#M355179</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Great! I think we want to keep ds as it is. But if we were to format directly on ds it should look like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc format;
    value ynu 1='Yes' 2='No' 3='Unknown';
    value bool 1='Yes';
run;

data ds;
    format var3 ynu. var2 bool.;
run;
proc print data=ds;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You would need a SET statement in the DATA step like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
    set ds;
    format var3 ynu. var2 bool.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But adding formats should be done in a data step only when you CREATE the data set. On a data set that already exists, please use the code from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; at &lt;A href="https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898586#M355177" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898586#M355177&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Oct 2023 10:21:46 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-10-14T10:21:46Z</dc:date>
    <item>
      <title>Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898426#M355095</link>
      <description>&lt;P&gt;Hi, this might be very simple but I cannot find a simple answer online. Perhaps I am asking it the wrong way. We have this dataset, but we need to uniformly either replace the "." with blanks or all blanks with "." This dataset is the result after combining multiple datasets.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;DS&lt;/TD&gt;&lt;TD&gt;months&lt;/TD&gt;&lt;TD&gt;time_point&lt;/TD&gt;&lt;TD&gt;var3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;DS1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;DS1&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;DS1&lt;/TD&gt;&lt;TD&gt;3.5&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;DS1&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;TD&gt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;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 12 Oct 2023 22:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898426#M355095</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-12T22:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898427#M355096</link>
      <description>&lt;P&gt;Please tell us if these variables are numeric or character, according to SAS (using PROC CONTENTS or using the SAS data set viewer)&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 22:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898427#M355096</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-12T22:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898428#M355097</link>
      <description>. represent numeric missing. If you want blanks when you export the data to a different format use option missing='';&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/n0qamf3yfjtwzhn1ran6xwblnlea.htm#:~:text=Specifies%20the%20character%20to%20print%20for%20missing%20numeric%20values.&amp;amp;text=Default%3A,is%20a%20period%20" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/n0qamf3yfjtwzhn1ran6xwblnlea.htm#:~:text=Specifies%20the%20character%20to%20print%20for%20missing%20numeric%20values.&amp;amp;text=Default%3A,is%20a%20period%20&lt;/A&gt;(.).</description>
      <pubDate>Thu, 12 Oct 2023 22:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898428#M355097</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-10-12T22:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898430#M355099</link>
      <description>&lt;P&gt;A missing value for a CHAR variable is a blank.&lt;BR /&gt;A missing value for a NUMERIC variable is a dot ( . ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really want to change that "behavior" of SAS??&lt;BR /&gt;It's possible, but a bit of a weird idea and I wouldn't do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you convert your numeric variable into a character one, the dots become blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 22:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898430#M355099</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-10-12T22:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898432#M355100</link>
      <description>&lt;P&gt;They're characters.&amp;nbsp; Before merging the datasets, I had to change numeric or boolean to character variables to allow to display the answers as Yes/No in the final table. The odd thing, or maybe is not?, is that for a character variable that was not changed, when merging, this same variable has some "." and others are blank.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 22:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898432#M355100</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-12T22:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898440#M355101</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;Before merging the datasets, I had to change numeric or boolean to character variables to allow to display the answers as Yes/No in the final table.&amp;nbsp;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then make sure that when you convert the values from char to num that you don't get a period for missing numerical values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also if this is just about printing numerical values then consider to create a format for the original variable instead of creating an additional character variable.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 04:30:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898440#M355101</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-13T04:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898446#M355102</link>
      <description>It might take 3 simple statements, such as:&lt;BR /&gt;&lt;BR /&gt;if var3="." then var3=" ";&lt;BR /&gt;&lt;BR /&gt;However, first confirm the values that look like blanks or dots.  Check using:&lt;BR /&gt;&lt;BR /&gt;proc freq data=have;&lt;BR /&gt;tables months timepoint var3 ;&lt;BR /&gt;format months timepoint var3 $hex6.;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 13 Oct 2023 06:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898446#M355102</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-10-13T06:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898447#M355103</link>
      <description>&lt;P&gt;Don't convert values like these to character. In character strings, 10 will be sorted before 2, just to name one issue. Boolean values are also best stored as numbers, with a format which displays 0 as "no", 1 as "yes" and missing as blank or "N/A". This allows direct use in conditions (0 and missing are considered false).&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 06:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898447#M355103</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-13T06:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898448#M355104</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The odd thing, or maybe is not?, is that for a character variable that was not changed, when merging, this same variable has some "." and others are blank.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As I said before, you need to show us your code. We don't know what you did, and if we're going to explain this, we need to see your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I agree with the others, you should be using formats and not character variables to represent numeric values. And I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt; it doesn't seem like a good idea to change the way SAS handles missing values. You could write your own code to do so, of course (which seems like what you are trying to do) but why bother, what is the benefit, it is extra work that doesn't seem to provide value and that combination of "Extra Work" with "No Value" is something I advise you to avoid.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 08:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898448#M355104</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-13T08:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898546#M355151</link>
      <description>&lt;P&gt;Thank you for everyone's answers. I am learning best practices in SAS so this is very helpful. I am not sure how to use formats. Is this within the same data step or a previous data step?This is the code I used to convert the variable type.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data ds1;
set ds;
character_var1= put(var3, 8.); /*Categories*/
character_var2= put(var2, 8.); /*Boolean*/
if character_var1 = 1 then character_var1 = 'Yes';
else if character_var1 = 2 then character_var1 = 'No';
else if character_var1 = 3 then character_var1 = 'Unknown';

if if character_var2 = 1 then character_var2 = 'Yes';

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here you can a sample where two variables that are numeric, are converted to character so we can print out the actual answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 20:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898546#M355151</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-13T20:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898548#M355152</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value ynu 1='Yes' 2='No' 3='Unknown';
    value bool 1='Yes';
run;
data ds1;
    set ds;
    format var3 ynu. var2 bool.;
run;
proc print data=ds1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With formats, you don't need to create character variables, and in fact you don't even need a new data set. When you created DS, you could assign the format then, and if you did that, ds1 would not need to be created at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 20:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898548#M355152</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-13T20:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898549#M355153</link>
      <description>&lt;P&gt;Great! I think we want to keep ds as it is. But if we were to format directly on ds it should look like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc format;
    value ynu 1='Yes' 2='No' 3='Unknown';
    value bool 1='Yes';
run;

data ds;
    format var3 ynu. var2 bool.;
run;
proc print data=ds;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2023 20:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898549#M355153</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-13T20:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898557#M355159</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if you don't make a new data set ds1 , you need set statement :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
  set ds;
  format var3 ynu. var2 bool.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your data set is super big (big size), I would re-format the columns with PROC DATASETS instead.&lt;BR /&gt;With PROC DATASETS you can change metadata only (without processing every observation in the data set -- with the data step above you input and output every observation without doing anything with it -- that's a waste of time and resources).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Koen&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 21:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898557#M355159</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-10-13T21:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898586#M355177</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work;
modify ds;
format var3 ynu. var2 bool.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Oct 2023 05:42:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898586#M355177</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-14T05:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898591#M355179</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Great! I think we want to keep ds as it is. But if we were to format directly on ds it should look like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc format;
    value ynu 1='Yes' 2='No' 3='Unknown';
    value bool 1='Yes';
run;

data ds;
    format var3 ynu. var2 bool.;
run;
proc print data=ds;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You would need a SET statement in the DATA step like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
    set ds;
    format var3 ynu. var2 bool.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But adding formats should be done in a data step only when you CREATE the data set. On a data set that already exists, please use the code from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; at &lt;A href="https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898586#M355177" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898586#M355177&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 10:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898591#M355179</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-14T10:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898607#M355189</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226521"&gt;@ANKH1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for everyone's answers. I am learning best practices in SAS so this is very helpful. I am not sure how to use formats. Is this within the same data step or a previous data step?This is the code I used to convert the variable type.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data ds1;
set ds;
character_var1= put(var3, 8.); /*Categories*/
character_var2= put(var2, 8.); /*Boolean*/
if character_var1 = 1 then character_var1 = 'Yes';
else if character_var1 = 2 then character_var1 = 'No';
else if character_var1 = 3 then character_var1 = 'Unknown';

if if character_var2 = 1 then character_var2 = 'Yes';

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here you can a sample where two variables that are numeric, are converted to character so we can print out the actual answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you set CHARACTER_VAR1 to the string '&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1' (seven spaces followed by the digit 1) and then later you ask SAS to convert it back into a number so you can compare it to the number 1 so you can decide to convert it to the string 'YES' instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just put 'YES" into it do begin with?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
  set ds;
  length character_var1 $7 ;
  if var3 = 1 then character_var1 = 'Yes';
  else if var3 = 2 then character_var1 = 'No';
  else if var3 = 3 then character_var1 = 'Unknown';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Oct 2023 15:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898607#M355189</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-10-14T15:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898801#M355253</link>
      <description>Thanks for sharing the links!</description>
      <pubDate>Mon, 16 Oct 2023 14:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898801#M355253</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-16T14:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898803#M355255</link>
      <description>I see! Thanks for the explanation.</description>
      <pubDate>Mon, 16 Oct 2023 14:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898803#M355255</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-16T14:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replace "." with blanks in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898804#M355256</link>
      <description>That was my first try, but the log marked an error, something along the lines of the variable not having the right format.</description>
      <pubDate>Mon, 16 Oct 2023 14:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-quot-quot-with-blanks-in-a-dataset/m-p/898804#M355256</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2023-10-16T14:41:20Z</dc:date>
    </item>
  </channel>
</rss>

