<?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: How to convert any date or numeric field into character in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414754#M101645</link>
    <description>&lt;P&gt;Thanks a lot for the valuable solution it is working&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2017 05:30:42 GMT</pubDate>
    <dc:creator>laxmikanthr</dc:creator>
    <dc:date>2017-11-20T05:30:42Z</dc:date>
    <item>
      <title>How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414235#M101485</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am trying to automate a process in which i need to convert any date or numeric field having any format to character field.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 03:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414235#M101485</guid>
      <dc:creator>laxmikanthr</dc:creator>
      <dc:date>2017-11-17T03:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414241#M101486</link>
      <description>&lt;P&gt;Isn't that what the PUT() function does? Is there some other functionality you need?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109940"&gt;@laxmikanthr&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am trying to automate a process in which i need to convert any date or numeric field having any format to character field.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 04:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414241#M101486</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-17T04:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414243#M101487</link>
      <description>&lt;P&gt;Use the function vformat() to get the format name and apply it with function putn().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
x = 99.99;
t = '16nov2017'd;
dt = '16nov2017:23:11:30'dt;
format t yymmdd10. dt datetime17.;
run;

data testStr;
array a x t dt;
array aStr{3} $32;
set test;
do i = 1 to dim(a);
    length fmt $32;
    fmt = vformat(a{i});
    if missing(fmt) then aStr{i} = put(a{i}, best.);
    else aStr{i} = putn(a{i}, fmt);
    end;
drop i fmt;
run; 

proc print data=testStr noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 04:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414243#M101487</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-11-17T04:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414244#M101488</link>
      <description>&lt;P&gt;Not sure what you purpose is, but isn't that what PROC PRINT does?&lt;/P&gt;
&lt;P&gt;If you want to store it into a character variable then use the VVALUE(),&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;charvar=vvalue(anyvar);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or VVALUEX() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set sashelp.class(obs=3) ;
  length vname $32 value $200 ;
  do vname='sex','age','height';
    value=vvaluex(vname);
    output;
  end;
  keep name vname value ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs     Name      vname        value

 1     Alfred     sex       M
 2     Alfred     age                 14
 3     Alfred     height              69
 4     Alice      sex       F
 5     Alice      age                 13
 6     Alice      height            56.5
 7     Barbara    sex       F
 8     Barbara    age                 13
 9     Barbara    height            65.3&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Nov 2017 04:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414244#M101488</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-17T04:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414416#M101538</link>
      <description>&lt;P&gt;Once a variable is numeric it stays numeric. Your process will have to create new variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One questions the actual value of this idea. The results will generally not sort properly and all of the functions to manipulate the values are basically gone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the purpose is a report read by people then any of the report procedures such as Print, Report or Tabulate are likely much better approaches than trying to change variables.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 15:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414416#M101538</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-17T15:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414754#M101645</link>
      <description>&lt;P&gt;Thanks a lot for the valuable solution it is working&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 05:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414754#M101645</guid>
      <dc:creator>laxmikanthr</dc:creator>
      <dc:date>2017-11-20T05:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert any date or numeric field into character in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414755#M101646</link>
      <description>&lt;P&gt;Thanks for the solution&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 05:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-any-date-or-numeric-field-into-character-in-sas/m-p/414755#M101646</guid>
      <dc:creator>laxmikanthr</dc:creator>
      <dc:date>2017-11-20T05:31:26Z</dc:date>
    </item>
  </channel>
</rss>

