<?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 - Change Format of Variable(Show Both Numeric and Character) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236952#M43427</link>
    <description>&lt;P&gt;Your simplest solution would be to add this statement to your DATA step following the INPUT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;column3 = column2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you could select column1 and column2 (with no formats) and column3 (with the format applied).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Nov 2015 14:13:54 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-11-30T14:13:54Z</dc:date>
    <item>
      <title>How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236943#M43426</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I have a dataset and I need to show one column as both numeric and character. I added a simple dataset. Actually, I tried some methods and I created it but I'm not sure am I using the right method.What "library=sasuser" provides different form empty proc format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
Length Column1 8 Column2 8;
Infile Datalines missover dlm=",";
Input Column1 Column2;
datalines;
1,0
2,0
3,0
4,0
1,1
2,1
3,1
4,1
1,2
2,2
3,2
4,2
;
Run;
proc format library=sasuser;
	value Column
	0='G(1)'
	1='G(2)'
	2='G(3)';
run;
proc format ;
	value Column
	0='G(1)'
	1='G(2)'
	2='G(3)';
run;

Proc sql;
Create table Want As
Select Column1
		,Column2 format=Column.
From Have;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/968i99AC1F86B09168E1/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="want.png" title="want.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2015 13:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236943#M43426</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2015-11-30T13:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236952#M43427</link>
      <description>&lt;P&gt;Your simplest solution would be to add this statement to your DATA step following the INPUT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;column3 = column2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you could select column1 and column2 (with no formats) and column3 (with the format applied).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2015 14:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236952#M43427</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-30T14:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236993#M43435</link>
      <description>&lt;P&gt;You can't. A column can be either numeric or character. If you need to display both types of information, the default becomes character. If you need to show both the formatted and unformatted value of a variable, then you need two variables. One is the raw data and the second either has the variable with a format attached OR you can convert it to the character variable with the put function:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
Create table Want As
Select Column1, Column2, put(Column2, Column.) as Column3 label="Column2 Formatted"
From Have;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Nov 2015 15:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/236993#M43435</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-11-30T15:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237028#M43437</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;&amp;nbsp;. Did you mean to ask if a column can be read into 2 different variables instead ?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2015 18:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237028#M43437</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-30T18:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237133#M43459</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the detailed information.&lt;/P&gt;
&lt;P&gt;Actually, I need to make changes on Column2 variable.&amp;nbsp;I don't want to make some changes on dataset&amp;nbsp;and don't want new variable. I try to show variable as G(1), G(2) and G(3). I mean changes on view of variable.I'm not sure&amp;nbsp;,maybe I can overwrite the Column2 by using your method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Method of Reeza*/&lt;BR /&gt;Proc sql;
Create table Want As
Select Column1,put(Column2, Column.) as Column2 label="Column2 Formatted"
From Have;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 09:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237133#M43459</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2015-12-01T09:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237178#M43469</link>
      <description>Use proc datasets to apply the format, this doesn't create a new dataset and doesn't process the dataset so it's efficient. Your underlying variable remains numeric, but has the format applied so it's viewed as G(1), G(2). If you use the method above, you create a new data set with a character variable. Up to you which method you use.&lt;BR /&gt;&lt;BR /&gt;proc datasets lib=work nodetails nolist;&lt;BR /&gt;modify have;&lt;BR /&gt;format column2 column.;&lt;BR /&gt;run;quit;</description>
      <pubDate>Tue, 01 Dec 2015 15:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237178#M43469</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-01T15:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237181#M43471</link>
      <description>&lt;P&gt;Have you tried proc report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc report data=work.have;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; columns Column1 Column2 Column2=Column2String; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; define Column1 / display;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; define Column2 / display;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; define Column2String / display format=Column. "Column2";&lt;BR /&gt;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 15:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237181#M43471</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2015-12-01T15:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237218#M43481</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your reply is just I want. Thank your for the information.&lt;/P&gt;
&lt;P&gt;I want to show data on dataset because I may use dataset to create another dataset but nice to know that, thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds﻿&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/58441"&gt;@kannand﻿&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 17:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/237218#M43481</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2015-12-01T17:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Change Format of Variable(Show Both Numeric and Character)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/238749#M43876</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just wonder why it brings G(1) instead of G(1) THK when we use put function.I want to see space characters too. Have you got an idea ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 18:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Change-Format-of-Variable-Show-Both-Numeric-and-Character/m-p/238749#M43876</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2015-12-10T18:31:55Z</dc:date>
    </item>
  </channel>
</rss>

