<?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 can a character variable be set as format by relating numeric value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403144#M97953</link>
    <description>&lt;P&gt;can i make format of character value which has relation to numeric value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA temp1;
     input subj 1-4 num_val 6 result $8-20 ;
     DATALINES;
1024 1 manual 
1167 1 manual 
1168 2 testing 
1201 2 testing 
1302 3 plain
1302 4 natural
  ;
RUN;&lt;/PRE&gt;&lt;P&gt;in the above program i want to use num_val&amp;nbsp; to get right order and at last want to call result to get the char value.&lt;/P&gt;&lt;P&gt;Can i create a format or one to one relation in the code and call it when needed?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Oct 2017 13:01:24 GMT</pubDate>
    <dc:creator>mj5</dc:creator>
    <dc:date>2017-10-11T13:01:24Z</dc:date>
    <item>
      <title>can a character variable be set as format by relating numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403144#M97953</link>
      <description>&lt;P&gt;can i make format of character value which has relation to numeric value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA temp1;
     input subj 1-4 num_val 6 result $8-20 ;
     DATALINES;
1024 1 manual 
1167 1 manual 
1168 2 testing 
1201 2 testing 
1302 3 plain
1302 4 natural
  ;
RUN;&lt;/PRE&gt;&lt;P&gt;in the above program i want to use num_val&amp;nbsp; to get right order and at last want to call result to get the char value.&lt;/P&gt;&lt;P&gt;Can i create a format or one to one relation in the code and call it when needed?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 13:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403144#M97953</guid>
      <dc:creator>mj5</dc:creator>
      <dc:date>2017-10-11T13:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: can a character variable be set as format by relating numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403155#M97956</link>
      <description>&lt;P&gt;Not exactly sure what you're asking but, if it's just how to create a format from that dataset:&lt;/P&gt;
&lt;PRE&gt;ATA temp1;
  input subj 1-4 num_val 6 result $8-20 ;
  DATALINES;
1024 1 manual 
1167 1 manual 
1168 2 testing 
1201 2 testing 
1302 3 plain
1302 4 natural
;

data fmtdata;
  set temp1 (rename=(num_val=start result=label));
  by start;
  retain fmtname 'ncodes' type 'N';
  if first.start;
run;

proc format cntlin = fmtdata;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 13:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403155#M97956</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-10-11T13:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: can a character variable be set as format by relating numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403156#M97957</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169706"&gt;@mj5&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Yes, that's one of the main purposes of formats. You apply them the values so that they print/display&amp;nbsp;formatted.&lt;/P&gt;
&lt;P&gt;Just define the format like:&lt;/P&gt;
&lt;PRE&gt;proc format;
  value myformat
    1='manual'
    2='testing'
    ....
    ;
run;

&lt;/PRE&gt;
&lt;P&gt;You then can apply the format like:&lt;/P&gt;
&lt;PRE&gt;DATA temp1;
     input subj 1-4 num_val 6 result $8-20 ;
     format num_val myformat.;
     DATALINES;
1024 1 manual 
....
;
run;
&lt;/PRE&gt;
&lt;P&gt;In doing so you will see the formatted values when "looking at them" but the internal values are still 1, 2, 3... and that's what you have to use in your SAS code for selections and the like.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 13:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/403156#M97957</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-11T13:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: can a character variable be set as format by relating numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/405432#M98635</link>
      <description>&lt;P&gt;How to call this format in data step. I tried calling by format&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;format num_val $ncodes.;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;but it doesnt work.&lt;/P&gt;&lt;P&gt;Any clue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 07:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/405432#M98635</guid>
      <dc:creator>mj5</dc:creator>
      <dc:date>2017-10-19T07:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: can a character variable be set as format by relating numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/405439#M98641</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169706"&gt;@mj5&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you're using&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;'s code then the format is numeric with name &lt;EM&gt;ncodes&lt;/EM&gt; - no $ required.&lt;/P&gt;
&lt;PRE&gt;format num_val ncodes.;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 08:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-a-character-variable-be-set-as-format-by-relating-numeric/m-p/405439#M98641</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-19T08:42:48Z</dc:date>
    </item>
  </channel>
</rss>

