<?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: I have numeric variables with character values, SAS9 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448281#M283431</link>
    <description>&lt;P&gt;Look at the formats assigned to the variables.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Mar 2018 18:35:14 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-03-23T18:35:14Z</dc:date>
    <item>
      <title>I have numeric variables with character values, SAS9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448279#M283430</link>
      <description>&lt;P&gt;Hello, I am a fairly new SAS user and I am facing an issue with my code and/or the dataset I am working with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running a proc contents I have 5 variables that have a Type of Numeric, but the values taken on by these 5 variables are either Present, Absent, or . (missing). When I run the below code I get a clean log with no errors or warning messages; although all 8 variables output I only get one observation with all missing values ( . )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;data &lt;/FONT&gt;redcap3;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;array&lt;/FONT&gt; LN(*) acr_ii acr_iii acr_iv acr_v;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;array&lt;/FONT&gt; Class(*) $ class_ii class_iii class_iv class_v;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;do&lt;/FONT&gt; i = 1 to dim(LN);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;class(i) = put(LN(i), $8.);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;end&lt;/FONT&gt;;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;drop&lt;/FONT&gt; i;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;proc print;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how to work with such variables? What steps do I need to take to change the variable type to character / or even code them as binary variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 18:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448279#M283430</guid>
      <dc:creator>sassafras_</dc:creator>
      <dc:date>2018-03-23T18:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: I have numeric variables with character values, SAS9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448281#M283431</link>
      <description>&lt;P&gt;Look at the formats assigned to the variables.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 18:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448281#M283431</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-23T18:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: I have numeric variables with character values, SAS9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448286#M283432</link>
      <description>&lt;P&gt;Can you please elaborate? Where would I go from there?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 18:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448286#M283432</guid>
      <dc:creator>sassafras_</dc:creator>
      <dc:date>2018-03-23T18:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: I have numeric variables with character values, SAS9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448296#M283433</link>
      <description>&lt;P&gt;You likely have a format attached to the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run a PROC CONTENTS and examine the output, specifically the type and format for your field of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A format allows data to be numeric underneath, but it can be viewed with the description.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if you had a data set with Age, 1, 2,3 etc but wanted to see the numbers as One, Two, Three, you could use a format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example below, I've created another age variable, identical the age value, but applied a format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;

age_numeric_format = age;
age_character = put(age, words.);

format age_numeric_format words.;
run;

title 'Demo of Formats';
proc print data=class;
run;

title 'Check formats and type for AGE variables';
proc contents data=class;run;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can remove a format from a variable to see the underlying values using a FORMAT statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class_remove_formats;
set class;

format age_numeric_format ;*removes formats from age;
run;

title 'No format on age numeric format variable';
proc print data=class_Remove_formats;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Removing the formats is likely all you need/want to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format class_ii class_iii class_iv class_v;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200832"&gt;@sassafras_&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I am a fairly new SAS user and I am facing an issue with my code and/or the dataset I am working with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When running a proc contents I have 5 variables that have a Type of Numeric, but the values taken on by these 5 variables are either Present, Absent, or . (missing). When I run the below code I get a clean log with no errors or warning messages; although all 8 variables output I only get one observation with all missing values ( . )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data &lt;/FONT&gt;redcap3;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;array&lt;/FONT&gt; LN(*) acr_ii acr_iii acr_iv acr_v;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;array&lt;/FONT&gt; Class(*) $ class_ii class_iii class_iv class_v;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;do&lt;/FONT&gt; i = 1 to dim(LN);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;class(i) = put(LN(i), $8.);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;end&lt;/FONT&gt;;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;drop&lt;/FONT&gt; i;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;proc print;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know how to work with such variables? What steps do I need to take to change the variable type to character / or even code them as binary variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 19:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448296#M283433</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-23T19:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: I have numeric variables with character values, SAS9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448314#M283434</link>
      <description>&lt;P&gt;Thank you so much for the constructive feedback! I didn't realize it was so simple to remove formats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked and I am able to move forward now. I greatly appreciate your help.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 20:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-have-numeric-variables-with-character-values-SAS9/m-p/448314#M283434</guid>
      <dc:creator>sassafras_</dc:creator>
      <dc:date>2018-03-23T20:05:34Z</dc:date>
    </item>
  </channel>
</rss>

